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


The following code:

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


simple patch

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

Scheduling for 1.5.0RC2.

Committed to trunk and merged to release branch.