web/lib/Zend/Controller/Dispatcher/Standard.php
changeset 807 877f952ae2bd
parent 207 621fa6caec0c
child 1230 68c69c656a2c
--- a/web/lib/Zend/Controller/Dispatcher/Standard.php	Thu Mar 21 17:31:31 2013 +0100
+++ b/web/lib/Zend/Controller/Dispatcher/Standard.php	Thu Mar 21 19:50:53 2013 +0100
@@ -15,9 +15,9 @@
  * @category   Zend
  * @package    Zend_Controller
  * @subpackage Dispatcher
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: Standard.php 22038 2010-04-28 18:54:22Z matthew $
+ * @version    $Id: Standard.php 24861 2012-06-01 23:40:13Z adamlundrigan $
  */
 
 /** Zend_Loader */
@@ -30,7 +30,7 @@
  * @category   Zend
  * @package    Zend_Controller
  * @subpackage Dispatcher
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 class Zend_Controller_Dispatcher_Standard extends Zend_Controller_Dispatcher_Abstract
@@ -257,6 +257,19 @@
         }
 
         /**
+         * If we're in a module or prefixDefaultModule is on, we must add the module name
+         * prefix to the contents of $className, as getControllerClass does not do that automatically.
+         * We must keep a separate variable because modules are not strictly PSR-0: We need the no-module-prefix
+         * class name to do the class->file mapping, but the full class name to insantiate the controller
+         */
+        $moduleClassName = $className;
+        if (($this->_defaultModule != $this->_curModule)
+            || $this->getParam('prefixDefaultModule'))
+        {
+            $moduleClassName = $this->formatClassName($this->_curModule, $className);
+        }
+
+        /**
          * Load the controller class file
          */
         $className = $this->loadClass($className);
@@ -265,12 +278,12 @@
          * Instantiate controller with request, response, and invocation
          * arguments; throw exception if it's not an action controller
          */
-        $controller = new $className($request, $this->getResponse(), $this->getParams());
+        $controller = new $moduleClassName($request, $this->getResponse(), $this->getParams());
         if (!($controller instanceof Zend_Controller_Action_Interface) &&
             !($controller instanceof Zend_Controller_Action)) {
             require_once 'Zend/Controller/Dispatcher/Exception.php';
             throw new Zend_Controller_Dispatcher_Exception(
-                'Controller "' . $className . '" is not an instance of Zend_Controller_Action_Interface'
+                'Controller "' . $moduleClassName . '" is not an instance of Zend_Controller_Action_Interface'
             );
         }