fixes #5603 Duplicate first parameter from the paginator with existing url args

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7777 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
AD7six 2008-10-23 22:20:03 +00:00
parent f4baaf60cb
commit ce0a71aef7
2 changed files with 34 additions and 1 deletions

View file

@ -956,7 +956,7 @@ class Controller extends Object {
$count = count($keys); $count = count($keys);
for ($i = 0; $i < $count; $i++) { for ($i = 0; $i < $count; $i++) {
if (!in_array($keys[$i], $vars)) { if (!in_array($keys[$i], $vars, true)) {
unset($options[$keys[$i]]); unset($options[$keys[$i]]);
} }
if (empty($whitelist) && ($keys[$i] === 'fields' || $keys[$i] === 'recursive')) { if (empty($whitelist) && ($keys[$i] === 'fields' || $keys[$i] === 'recursive')) {

View file

@ -565,6 +565,39 @@ class ControllerTest extends CakeTestCase {
$this->assertEqual($Controller->ControllerPaginateModel->extra, $expected); $this->assertEqual($Controller->ControllerPaginateModel->extra, $expected);
$this->assertEqual($Controller->ControllerPaginateModel->extraCount, $expected); $this->assertEqual($Controller->ControllerPaginateModel->extraCount, $expected);
} }
/**
* testPaginatePassedArgs method
*
* @return void
* @access public
*/
function testPaginatePassedArgs() {
$Controller =& new Controller();
$Controller->uses = array('ControllerPost');
$Controller->passedArgs[] = array('1', '2', '3');
$Controller->params['url'] = array();
$Controller->constructClasses();
$Controller->paginate = array(
'fields' => array(),
'order' => '',
'limit' => 5,
'page' => 1,
'recursive' => -1
);
$conditions = array();
$Controller->paginate('ControllerPost',$conditions);
$expected = array(
'fields' => array(),
'order' => '',
'limit' => 5,
'page' => 1,
'recursive' => -1,
'conditions' => array()
);
$this->assertEqual($Controller->params['paging']['ControllerPost']['options'],$expected);
}
/** /**
* testDefaultPaginateParams method * testDefaultPaginateParams method
* *