mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
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:
parent
f4baaf60cb
commit
ce0a71aef7
2 changed files with 34 additions and 1 deletions
|
@ -956,7 +956,7 @@ class Controller extends Object {
|
|||
$count = count($keys);
|
||||
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
if (!in_array($keys[$i], $vars)) {
|
||||
if (!in_array($keys[$i], $vars, true)) {
|
||||
unset($options[$keys[$i]]);
|
||||
}
|
||||
if (empty($whitelist) && ($keys[$i] === 'fields' || $keys[$i] === 'recursive')) {
|
||||
|
|
|
@ -565,6 +565,39 @@ class ControllerTest extends CakeTestCase {
|
|||
$this->assertEqual($Controller->ControllerPaginateModel->extra, $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
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue