Issues

ZF-5617: Static prefix and loaded plugins do not work in Zend_Loader_PluginLoader

Issue Type: Bug Created: 2009-01-22T11:14:11.000+0000 Last Updated: 2009-01-22T11:40:24.000+0000 Status: Resolved Fix version(s): Reporter: Sven Franke (snefit) Assignee: Benjamin Eberlei (beberlei) Tags: - Zend_Loader

Related issues: - ZF-5208

Attachments:

Description

When using Zend_Loader_PluginLoader with a 'staticRegistryName' the static stuff will not work. The manual states that when using the staticRegistryName, another instance can use the already loaded plugins with the same registryname.

So:

<pre class="highlight">
$loader1 = new Zend_Loader_PluginLoader(array('Prefix_One', 'Prefix/One/'), 'STATICREGISTRYNAME');
$loader1->load('Bla');

echo $loader1->isLoaded('Bla'); // true

$loader2 = new Zend_Loader_PluginLoader(array(), 'STATICREGISTRYNAME');
$loader2->isLoaded('Bla'); // should be true according to manual....

But when I look in the constructor of Zend_Loader_PluginLoader I see that $_staticPrefixToPaths and $_staticLoadedPlugins for this registryname are cleared so that there are no loaded plugins at all (for that registryname).

<pre class="highlight">
    public function __construct(Array $prefixToPaths = array(), $staticRegistryName = null)
    {
        if (is_string($staticRegistryName) && !empty($staticRegistryName)) {
            $this->_useStaticRegistry = $staticRegistryName;
            self::$_staticPrefixToPaths[$staticRegistryName] = array(); // ---> with this the static functionality is gone.
            self::$_staticLoadedPlugins[$staticRegistryName] = array(); // ---> with this the static functionality is gone.
        }

        foreach ($prefixToPaths as $prefix => $path) {
            $this->addPrefixPath($prefix, $path);
        }
    }

I think that the wrong variables are cleared. It should not clear the static vars, but the 'normal' ones.

<pre class="highlight">
    public function __construct(Array $prefixToPaths = array(), $staticRegistryName = null)
    {
        if (is_string($staticRegistryName) && !empty($staticRegistryName)) {
            $this->_useStaticRegistry = $staticRegistryName;
            $this->_prefixToPaths[$staticRegistryName] = array();
            $this->_loadedPlugins[$staticRegistryName] = array();
        }

        foreach ($prefixToPaths as $prefix => $path) {
            $this->addPrefixPath($prefix, $path);
        }
    }

Comments

Posted by Benjamin Eberlei (beberlei) on 2009-01-22T11:20:07.000+0000

This issue is a duplicate of ZF-5208, which was fixed in 1.7.3

Posted by Sven Franke (snefit) on 2009-01-22T11:40:24.000+0000

I'm sorry, missed that one! I thought i was already using 1.7.3 but it was 1.7.2.

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