ZF-5410: Too many require_once() in class Zend_Controller_Action {} method __call($methodName, $args) {}
Description
abstract class Zend_Controller_Action { .... public function __call($methodName, $args) { if ('Action' == substr($methodName, -6)) { require_once 'Zend/Controller/Action/Exception.php'; $action = substr($methodName, 0, strlen($methodName) - 6); require_once 'Zend/Controller/Action/Exception.php'; throw new Zend_Controller_Action_Exception(sprintf('Action "%s" does not exist and was not trapped in __call()', $action), 404); }
require_once 'Zend/Controller/Action/Exception.php';
throw new Zend_Controller_Action_Exception(sprintf('Method "%s" does not exist and was not trapped in __call()', $methodName), 500);
}
}
there are too many require_once() in __call($methodName, $args) method, can be rewriten like this:
abstract class Zend_Controller_Action { .... public function __call($methodName, $args) { require_once 'Zend/Controller/Action/Exception.php'; if ('Action' == substr($methodName, -6)) { $action = substr($methodName, 0, strlen($methodName) - 6); throw new Zend_Controller_Action_Exception(sprintf('Action "%s" does not exist and was not trapped in __call()', $action), 404); } throw new Zend_Controller_Action_Exception(sprintf('Method "%s" does not exist and was not trapped in __call()', $methodName), 500); } }
Comments
Posted by Matthew Weier O'Phinney (matthew) on 2009-01-06T03:43:58.000+0000
Fixed in trunk in r13520; patched to release 1.7 in r13521.