ZF-7365: Zend_Application_Bootstrap_BootstrapAbstract lower case names convert plugins and array_key_exists

Issue Type: Bug Created: 2009-07-23T06:05:18.000+0000 Last Updated: 2012-06-17T14:00:45.000+0000 Status: Open Fix version(s): Reporter: Mihail Chumachkin (chumachkin_m) Assignee: Ramon Henrique Ornelas (ramon) Tags: - Zend_Application

Related issues: Attachments:


Look at BootStrapAbstract.php function : public function getPluginResource($resource) code: if (array_key_exists(strtolower($resource), $this->_pluginResources)) {

var_dump(strtolower($resource)) = "layout211_resource_layout"

but in the var_dump( $this->_pluginResources) = "Layout211_Resource_Layout" it still as original

Look at PluginLoader.php function: public function setOptions(array $options) code: $options = array_change_key_case($options, CASE_LOWER);

And strlower conversion problem in function: protected function _loadPluginResource($resource, $options) code: $className = $this->getPluginLoader()->load(strtolower($resource), false);

This code convert only first line in array.

If i set Resource name as :

$application->setOptions( $application->mergeOptions( $application->getOptions(), array( 'pluginPaths'=> array( 'Layout211_Resource_Layout'=> APPLICATION_PATH .'/resource' ), 'resources' => array( 'Layout211_Resource_Layout' => array() ) ) ) );


Posted by Sylvain Bernier (sb_demarque) on 2012-03-30T15:04:49.000+0000

It might not be the best issue description in the world, but there is definitely case consistency issues with plugin resource names in Zend_Application_Bootstrap_BootstrapAbstract. I am battling them right now, in Zend Framework 1.11.11.

Quick example case:

  • MyBootstrap extends Zend_Application_Bootstrap_Bootstrap ;
  • Zend_Application_Bootstrap_Bootstrap::__construct() does $this->registerPluginResource('FrontController') ;
  • In MyBootstrap::__construct(), you might want to do $this->unregisterPluginResource('FrontController'), but it will not work, because unregisterPluginResource() will strtolower('FrontController') but registerPluginResource() registered it as 'FrontController' in $this->_pluginResources.

I have seen many inconsistencies with how $this->_pluginResources is handled in Zend_Application_Bootstrap_BootstrapAbstract. Please review all accesses to $this->_pluginResources and make sure that they are always either case sensitive or not.

Feel free to ask questions about the problem, there is definitely some things to fix in there. Thanks!

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.