#5724: changes to extractParams breaks caching of elements in views.
---------------------------+------------------------------------------------
    Reporter:  mustan9     |          Type:  Bug  
      Status:  new         |      Priority:  High 
   Milestone:  1.2.x.x     |     Component:  Cache
     Version:  RC3         |      Severity:  Major
    Keywords:  1.2.0.7692  |   Php_version:  PHP 5
Cake_version:              |  
---------------------------+------------------------------------------------
 There is a bug in RC3 in the dispatcher.php when view caching is enabled.
 The bug exists only when the view cache file "home.php" is created for the
 root path of the website. For example: http://www.example.com would have
 the view cached to "home.php".

 When this file exists, and a view calls requestAction the dispatcher will
 check if the element is cached using '/' as the URL, and not the passed
 URL from when requestAction was called.

 This is only a problem when an array is called on the requestAction.


 {{{
 $categories =
 $this->requestAction(array('controller'=>'documents','action'=>'categories'));
 }}}

 When the dispatcher for this requestAction is called the following code
 processes the URL.

 {{{
 if (is_array($url)) {
   $url = $this->__extractParams($url, $additionalParams);
   $parse = false;
 }
 }}}

 The problem is related to these changes in RC3 for the extractParams
 method.


 {{{
 /**
  * Sets the params when $url is passed as an array to
 Object::requestAction();
  *
  * @param array $url
  * @param array $additionalParams
  * @return null
  * @access private
  * @todo commented Router::url(). this improved performance,
  *               will work on this more later.
  */
         function __extractParams($url, $additionalParams = array()) {
                 $defaults = array('pass' => array(), 'named' => array(),
 'form' => array());
                 $this->params = array_merge($defaults, $url,
 $additionalParams);
                 //$url = Router::url($url);
                 //return $url;
         }

 }}}

 As you can see a developer commented out the returned routed URL. This
 erases the path requested by requestAction, and if there exists a cached
 home.php file that will be returned to by these lines in dispatcher.


 {{{
                 if ($this->cached($url)) {
                         $this->_stop();
                 }
 }}}

 Uncommenting the lines in extractParams resolves the problem.

-- 
Ticket URL: <https://trac.cakephp.org/ticket/5724>
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
-~----------~----~----~----~------~----~------~--~---

  • [CakePHP : The Rapid Dev... CakePHP : The Rapid Development Framework for PHP

Reply via email to