#6347: beforeRedirect() doesn't work well ---------------------------+------------------------------------------------ Reporter: regen | Owner: Type: Bug | Status: new Priority: Medium | Milestone: 1.2.x.x Component: Controller | Version: 1.2 Final Severity: Normal | Resolution: Keywords: | Php_version: n/a Cake_version: | ---------------------------+------------------------------------------------ Comment (by MASA-P):
A little while ago, regen and I discussed about this problem that occur in a controller that set two or more components that have beforeRedirect callback. Not only URL but also all response from components, are overwritten by the hooker in cake/libs/controllers/component.php.[[BR]] [[BR]] For example...[[BR]] [[BR]] app/controllers/foo_controller.php[[BR]] {{{ class FooController extends AppController { var $name = 'Foo'; var $uses = array(); var $components = array('Hoge', 'Fuga'); function one(){ $this->redirect('/foo/two'); } function two(){ var_dump($this->params['named']['a']); var_dump($this->params['named']['b']); } } }}} [[BR]] app/controllers/components/hoge.php[[BR]] {{{ class HogeComponent extends Object { function beforeRedirect(&$controller, $url, $status, $exit){ //add named params // $url .= '/a:10/b:20'; //response // return array( 'url' => $url, 'status' => $status, 'exit' => $exit, ); } } }}} [[BR]] app/controllers/components/huga.php[[BR]] {{{ class FugaComponent extends Object { function beforeRedirect(&$controller, $url, $status, $exit){ //add named params // $url .= '/a:100/b:200'; //response // return array( 'url' => $url, 'status' => $status, 'exit' => $exit, ); } } }}} [[BR]] Access /foo/one, results are a = 100 and b = 200.[[BR]] [[BR]] Then, change a order of components. First is 'Huga', and second is 'Hoge'. And access /foo/one.[[BR]] Maybe results are a = 10 and b = 20.[[BR]] [[BR]] I think that one of solution for this problem is [https://trac.cakephp.org/ticket/6348 #6348]. -- Ticket URL: <https://trac.cakephp.org/ticket/6347#comment:3> CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/> Cake is a rapid development framework for PHP which uses commonly known design patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC. Our primary goal is to provide a structured framework that enables PHP users at all levels to rapidly develop robust web applications, without any loss to flexibility. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "tickets cakephp" group. To post to this group, send email to tickets-cakephp@googlegroups.com To unsubscribe from this group, send email to tickets-cakephp+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/tickets-cakephp?hl=en -~----------~----~----~----~------~----~------~--~---