#5628: requestAction does not receive $this->data anymore
--------------------------------+-------------------------------------------
    Reporter:  braulio          |         Owner:  mark_story
        Type:  Bug              |        Status:  reopened  
    Priority:  Medium           |     Milestone:  1.2.x.x   
   Component:  Controller       |       Version:  RC3       
    Severity:  Normal           |    Resolution:            
    Keywords:  requestAction    |   Php_version:  PHP 5     
Cake_version:  11.2.0.7692 RC3  |  
--------------------------------+-------------------------------------------
Changes (by braulio):

  * status:  closed => reopened
  * resolution:  fixed =>

Comment:

 Yes.  Of course... I am sorry because my example was wrong (I just copied
 and pasted one of my experiments).  I was actually using
 {{{$this->requestAction('/users/login')}}} y also have tried with
 {{{$this->requestAction(array( 'controller' => 'users', 'action' =>
 'login', 'data' => $this->data ))}}}[[BR]]
 [[BR]]
 I saw your tests, but IMHO those are very simplistic.  Those tests do not
 take into account all the variables.  I am using the Auth component and I
 am accessing the login action (which according to the manual is always
 allowed).  Something strange was the fact that a redirection was triggered
 when I called {{{requestAction('/users/login')}}}.[[BR]]
 [[BR]]
 {{{requestAction('/users/login')}}} was redirected to {{{/users/login}}}.
 Strange, isn't it?[[BR]]
 [[BR]]
 I think I found the bug.  In Object::requestAction you have the following
 code:
 {{{
 $params = array_merge(array('autoRender' => 0, 'return' => 1, 'bare' => 1,
 'requested' => 1, 'url' => array()), $extra);
 $dispatcher = new Dispatcher;
 return $dispatcher->dispatch($url, $params);
 }}}
 However I think that code should be:
 {{{
 $params = array_merge(array('autoRender' => 0, 'return' => 1, 'bare' => 1,
 'requested' => 1), $extra);
 $dispatcher = new Dispatcher;
 return $dispatcher->dispatch($url, $params);
 }}}
 because inside Dispatcher::dispatch when you reach this code
 ($additionalParams is $params coming from the call just above):
 {{{
 if ($parse) {
         $this->params = array_merge($this->parseParams($url),
 $additionalParams);
 }
 }}}
 you destroy {{{$this->params['url']['url']}}} (equal to 'users/login').
 {{{$this->params['url']}}} will become an empty array.  That fact in
 combination with the fact that the Auth component is being used will call
 a redirection inside {{{$controller->Component->startup($controller)}}}
 (when Auth is started) because the URL perceived by the Auth component is
 not /users/login since {{{$this->params['url']['url']}}} was erased.[[BR]]
 [[BR]]
 That is why I was thinking that {{{$this->data}}} was no longer passed.
 That works fine, data is passed.  And those tests prove it, but they are
 not sufficient to prove that there is not a bug, because the problem
 needed tracing and human judgment.[[BR]]
 [[BR]]
 That bug was added at some point in 1.2.x.x because this used to work.
 The title of this report should be changed.[[BR]]
 [[BR]]
 Do you agree with me?

-- 
Ticket URL: <https://trac.cakephp.org/ticket/5628#comment:6>
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to