#5755: requestAction is causing a strange problem
-------------------------------+--------------------------------------------
    Reporter:  joelstein       |         Owner:          
        Type:  Bug             |        Status:  reopened
    Priority:  Medium          |     Milestone:  1.2.x.x 
   Component:  General         |       Version:  RC3     
    Severity:  Normal          |    Resolution:          
    Keywords:                  |   Php_version:  n/a     
Cake_version:  1.2.0.7692 RC3  |  
-------------------------------+--------------------------------------------
Changes (by aramisbear):

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

Comment:

 I'm having the same issue.  I tried calling requestAction from within a
 Helper function that was used in an admin view.

 The action that it was calling was just starting to be setup so it was
 just an empty function with a view that had a line of text in it.  What I
 noticed was that, when using array return the first call would return
 nothing but the second returned the actual ouput.

 [[BR]]

 Here is the trace code that I used to show the error (these were called
 within a Helper).

 {{{
 echo "FIRST CALL (" . $this->requestAction('/admin/tags/has_alot') . ")";
 echo "SECOND CALL (" .
 $this->requestAction('/admin/tags/has_alot',array('return')) . ")";
 echo "THIRD CALL (" .
 $this->requestAction('/admin/tags/has_alot',array('return')) . ")";
 }}}

 I added 2 debug statements to the core Object::requestAction function as
 follows:

 {{{
 function requestAction($url, $extra = array()) {
            debug ($url);
 }}}

 AND

 {{{
 debug ($params);

 $dispatcher = new Dispatcher;
 return $dispatcher->dispatch($url, $params);
 }}}

 == Resulting Output ==


 cake/libs/object.php (line 86)

 /admin/tags/has_alot

 cake/libs/object.php (line 101)

 Array
 (
     [autoRender] => 0
     [return] => 1
     [bare] => 1
     [requested] => 1
 )


 FIRST CALL ()cake/libs/object.php (line 86)

 /admin/tags/has_alot

 cake/libs/object.php (line 101)

 Array
 (
     [autoRender] => 1
     [return] => 0
     [bare] => 1
     [requested] => 1
     [0] => return
 )


 SECOND CALL ()THIRD CALL (tags has a lot)


 == Analysis ==

 You can see the first call without the return is passed properly.  The
 second is passed properly but returns no output and the third does not hit
 the debug functions but does return the output.

 I'm at a loss for what may be causing this error.

-- 
Ticket URL: <https://trac.cakephp.org/ticket/5755#comment:2>
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