ZF-6134: Zend_Loader_PluginLoader accepts duplicate prefix paths
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)