Issues

ZF-5410: Too many require_once() in class Zend_Controller_Action {} method __call($methodName, $args) {}

Issue Type: Performance Improvement Created: 2009-01-06T03:23:43.000+0000 Last Updated: 2009-01-06T03:44:10.000+0000 Status: Resolved Fix version(s): - 1.7.3 (19/Jan/09)

Reporter: Rolands (tabos) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Controller

Related issues: Attachments:

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.

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