ZF-6134: Zend_Loader_PluginLoader accepts duplicate prefix paths

Issue Type: Bug Created: 2009-03-26T13:02:27.000+0000 Last Updated: 2009-09-17T15:30:29.000+0000 Status: Resolved Fix version(s): - 1.9.3 (22/Sep/09)

Reporter: Matthew Turland (elazar) Assignee: Benjamin Eberlei (beberlei) Tags: - Zend_Loader

Related issues: Attachments: - patch.diff


Zend_Loader_PluginLoader::addPrefixPath has no check to ensure that the same path is not added multiple times per prefix. This issue can be inadvertently triggered by the following process:

  1. Zend_Form is instantiated. 2) Zend_Form_SubForm is instantiated and set to use the same plugin loader as the form instance. 3) The subform instance is added to the form via Zend_Form::addSubForm, which implicitly adds all the form's loader's prefix paths to the subform (which adds them to the subform's loader, also the form's loader - and round and round we go).

The solution is to have Zend_Loader_PluginLoader::addPrefixPath check $this->_prefixToPaths[$prefix] for $path before adding it. Though I'm not entirely certain how or why it would have this effect, making this change removed a huge bottleneck in a Zend_Form-based class I dealt with recently and shaved the load time from 15 seconds to 5 seconds.

A patch to implement the change is attached. (I svn blame Ralph for this. :P)


Posted by Matthew Turland (elazar) on 2009-03-26T13:34:28.000+0000

Added unittest.diff which patches tests/Zend/Loader/PluginLoaderTest.php to add a test case for this patch.

Posted by Benjamin Eberlei (beberlei) on 2009-09-17T15:30:28.000+0000

Patches by Matthew applied and tested, committed and merged into 1.9 release branch.

Have you found an issue?

See the Overview section for more details.


© 2006-2019 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.