Skip to content

Commit 6c0dfe9

Browse files
committed
Fixing error where params[url] has moved.
1 parent ee0dc78 commit 6c0dfe9

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

cake/libs/controller/components/request_handler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ function __construct(ComponentCollection $collection, $settings = array()) {
121121
public function initialize(&$controller, $settings = array()) {
122122
$this->request = $controller->request;
123123
$this->response = $controller->response;
124-
if (isset($controller->params['url']['ext'])) {
125-
$this->ext = $controller->params['url']['ext'];
124+
if (isset($this->request->params['url']['ext'])) {
125+
$this->ext = $this->request->params['url']['ext'];
126126
}
127127
if (empty($this->ext)) {
128128
$accepts = $this->request->accepts();

cake/libs/controller/controller.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1039,7 +1039,7 @@ public function paginate($object = null, $scope = array(), $whitelist = array())
10391039
), E_USER_WARNING);
10401040
return array();
10411041
}
1042-
$options = array_merge($this->request->params, $this->request->params['url'], $this->passedArgs);
1042+
$options = array_merge($this->request->params, $this->request->query, $this->passedArgs);
10431043

10441044
if (isset($this->paginate[$object->alias])) {
10451045
$defaults = $this->paginate[$object->alias];

cake/tests/cases/libs/controller/controller.test.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ function testPaginate() {
610610
$Controller = new Controller($request);
611611
$Controller->uses = array('ControllerPost', 'ControllerComment');
612612
$Controller->passedArgs[] = '1';
613-
$Controller->params['url'] = array();
613+
$Controller->query = array();
614614
$Controller->constructClasses();
615615

616616
$results = Set::extract($Controller->paginate('ControllerPost'), '{n}.ControllerPost.id');
@@ -700,7 +700,7 @@ function testPaginateExtraParams() {
700700

701701
$Controller->uses = array('ControllerPost', 'ControllerComment');
702702
$Controller->passedArgs[] = '1';
703-
$Controller->params['url'] = array();
703+
$Controller->query = array();
704704
$Controller->constructClasses();
705705

706706
$Controller->passedArgs = array('page' => '-1', 'contain' => array('ControllerComment'));
@@ -731,7 +731,7 @@ function testPaginateExtraParams() {
731731

732732
$Controller = new Controller($request);
733733
$Controller->uses = array('ControllerPaginateModel');
734-
$Controller->params['url'] = array();
734+
$Controller->query = array();
735735
$Controller->constructClasses();
736736
$Controller->paginate = array(
737737
'ControllerPaginateModel' => array('contain' => array('ControllerPaginateModel'), 'group' => 'Comment.author_id')
@@ -760,7 +760,7 @@ function testPaginateFieldsDouble(){
760760
$Controller =& new Controller();
761761
$Controller->uses = array('ControllerPost');
762762
$Controller->request = $this->getMock('CakeRequest');
763-
$Controller->request->params['url'] = array();
763+
$Controller->request->query = array();
764764
$Controller->constructClasses();
765765

766766
$Controller->paginate = array(
@@ -801,7 +801,7 @@ public function testPaginatePassedArgs() {
801801
$Controller = new Controller($request);
802802
$Controller->uses = array('ControllerPost');
803803
$Controller->passedArgs[] = array('1', '2', '3');
804-
$Controller->params['url'] = array();
804+
$Controller->query = array();
805805
$Controller->constructClasses();
806806

807807
$Controller->paginate = array(
@@ -837,7 +837,7 @@ function testPaginateSpecialType() {
837837
$Controller = new Controller($request);
838838
$Controller->uses = array('ControllerPost', 'ControllerComment');
839839
$Controller->passedArgs[] = '1';
840-
$Controller->params['url'] = array();
840+
$Controller->query = array();
841841
$Controller->constructClasses();
842842

843843
$Controller->paginate = array('ControllerPost' => array('popular', 'fields' => array('id', 'title')));
@@ -861,7 +861,7 @@ function testDefaultPaginateParams() {
861861

862862
$Controller = new Controller($request);
863863
$Controller->modelClass = 'ControllerPost';
864-
$Controller->params['url'] = array();
864+
$Controller->query = array();
865865
$Controller->paginate = array('order' => 'ControllerPost.id DESC');
866866
$Controller->constructClasses();
867867
$results = Set::extract($Controller->paginate('ControllerPost'), '{n}.ControllerPost.id');
@@ -881,7 +881,7 @@ function testPaginateOrderVirtualField() {
881881

882882
$Controller = new Controller($request);
883883
$Controller->uses = array('ControllerPost', 'ControllerComment');
884-
$Controller->params['url'] = array();
884+
$Controller->query = array();
885885
$Controller->constructClasses();
886886
$Controller->ControllerPost->virtualFields = array(
887887
'offset_test' => 'ControllerPost.id + 1'
@@ -1499,7 +1499,7 @@ function testRequestHandlerPrefers(){
14991499

15001500
$Controller->components = array("RequestHandler");
15011501
$Controller->modelClass='ControllerPost';
1502-
$Controller->params['url'] = array('ext' => 'rss');
1502+
$Controller->request->params['url'] = array('ext' => 'rss');
15031503
$Controller->constructClasses();
15041504
$Controller->Components->trigger('initialize', array(&$Controller));
15051505
$Controller->beforeFilter();

0 commit comments

Comments
 (0)