Issues

ZF-12302: Zend_Controller_Action::_forward() causes infinite loop

Issue Type: Bug Created: 2012-06-22T22:16:42.000+0000 Last Updated: 2012-06-22T22:16:42.000+0000 Status: Open Fix version(s): Reporter: Derek Gray (dgray90) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Controller

Related issues: Attachments:

Description

Marked as minor due to relatively simple workaround.

When using the _forward method within the preDispatch method, an infinite loop is caused. Example code:

<pre class="highlight">
class ResourcesController extends Zend_Controller_Action {

    public function preDispatch () {
        if ($this->_request->action != 'index') {
            $this->_forward('index');
        }
    }
    
    public function indexAction () {
    
    }

}

This causes an infinite loop when attempting to access [baseUrl]/resources/[actionBesidesIndex].

If the forward arguments are extended in the following manner, however...

<pre class="highlight">
class ResourcesController extends Zend_Controller_Action {

    public function preDispatch () {
        if ($this->_request->action != 'index') {
            $this->_forward('index',null,null,array('action'=>'index'));
        }
    }
    
    public function indexAction () {
    
    }

}

...then the _forward works as expected.

This could use a very simple patch, unless for some not-readily-apparent reason this one line of code would cause some undesirable side-effects:

<pre class="highlight">

*** /mnt/www/projects-live/library/Zend/Controller/Action.php   2012-03-07 14:56:40.000000000 -0600
--- Action.php  2012-06-22 17:13:14.000000000 -0500
***************
*** 673,678 ****
--- 673,679 ----
          }

          $request->setActionName($action)
+                 ->setParam('action',$action)
                  ->setDispatched(false);
      }

Comments

No comments to display

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts