Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.7.7
-
Fix Version/s: 1.9.3
-
Component/s: Zend_Loader
-
Labels:None
Description
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.
)
Added unittest.diff which patches tests/Zend/Loader/PluginLoaderTest.php to add a test case for this patch.