ZF-2758: fatal error: Zend_Controller_Action_Helper_ContextSwitch depends on Zend_Layout but doesn't include it

Issue Type: Bug Created: 2008-02-28T16:37:11.000+0000 Last Updated: 2008-03-21T16:25:45.000+0000 Status: Resolved Fix version(s): - 1.5.0 (17/Mar/08)

Reporter: Cole Snodgrass (cole.snodgrass) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Controller

Related issues: Attachments:


The following code:

<pre class="highlight">
class IndexController extends Zend_Controller_Action {
    public function init() {
        $contextSwitch = $this->_helper->getHelper('contextSwitch');
        $contextSwitch->addActionContext('index', 'json')->initContext('json');
    public function indexAction() {
        $this->view->foo = 'bar'; 

produces the following fatal error if 'Zend_Layout' isn't included in the project: Fatal error: Class 'Zend_Layout' not found in /usr/share/php/Zend/Controller/Action/Helper/ContextSwitch.php on line 252


Posted by Cole Snodgrass (cole.snodgrass) on 2008-02-28T16:57:30.000+0000

simple patch

<pre class="highlight">
@@ -249,6 +249,7 @@
         if ($this->getAutoDisableLayout()) {
+            require_once 'Zend/Layout.php';
             $layout = Zend_Layout::getMvcInstance();
             if (null !== $layout) {

Posted by Matthew Weier O'Phinney (matthew) on 2008-03-06T09:35:18.000+0000

Scheduling for 1.5.0RC2.

Posted by Matthew Weier O'Phinney (matthew) on 2008-03-06T11:23:38.000+0000

Committed to trunk and merged to release branch.

Have you found an issue?

See the Overview section for more details.


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

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