Issues

ZF-8509: CLONE -Zend_Application_Bootstrap_BootstrapAbstract::hasResourcePlugin() causes warnings.

Issue Type: Bug Created: 2009-12-09T15:30:57.000+0000 Last Updated: 2009-12-09T17:27:44.000+0000 Status: Resolved Fix version(s): Reporter: Hinikato Dubrai (hinikato) Assignee: Dolf Schimmel (Freeaqingme) (freak) Tags: - Zend_Application

Related issues: - ZF-7550

Attachments:

Description

Zend_Application_Bootstrap_BootstrapAbstract::hasResourcePlugin() causes warnings.

See the next code:

<pre class="highlight">
require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance()
    ->suppressNotFoundWarnings(false)
    ->setFallbackAutoloader(true);
$bootstrap = new Zend_Application_Bootstrap_Bootstrap(new Zend_Application('test'));
if ($bootstrap->hasPluginResource('foo')) {   // causes warnings.
}

This warning caused by Zend_Application_Bootstrap_BootstrapAbstract::getPluginResource($resource) method. See the next code:

<pre class="highlight">
    public function getPluginResource($resource)
    {
        //...
            if (class_exists($plugin)) {    // <-- here. May be need to be class_exists($plugin, false);
                $spec = (array) $spec;
                $spec['bootstrap'] = $this;
                $instance = new $plugin($spec);
                $pluginName = $this->_resolvePluginResourceName($instance);
                unset($this->_pluginResources[$plugin]);
                $this->_pluginResources[$pluginName] = $instance;

                if (0 === strcasecmp($resource, $pluginName)) {
                    return $instance;
                }
            }
        //...
    }

Comments

Posted by Hinikato Dubrai (hinikato) on 2009-12-09T15:36:07.000+0000

Please try the following code:

<pre class="highlight">
$bootstrap = new Zend_Application_Bootstrap_Bootstrap(new Zend_Application('test'));
if ($bootstrap->hasPluginResource('test')) {}

Causes warnings:

<pre class="highlight">
Warning: include(FrontController.php) [function.include]: failed to open stream: No such file or directory in Z:\usr\local\php-5.2.8\include\Zend\Loader.php on line 136

Warning: include() [function.include]: Failed opening 'FrontController.php' for inclusion (include_path='Z:\home\localhost\www/library;.;<a>z:/usr/local/php-5.2.8/include</a>') in Z:\usr\local\php-5.2.8\include\Zend\Loader.php on line 136

I checked out last working copy from a repositary in problem still here.

Posted by Dolf Schimmel (Freeaqingme) (freak) on 2009-12-09T15:36:33.000+0000

Since you already noticed it is a duplicate of a non-issue. Do you agree with me to close this issue as 'duplicate'?

Posted by Hinikato Dubrai (hinikato) on 2009-12-09T15:37:07.000+0000

No, problem still in SVN repositary.

Posted by Hinikato Dubrai (hinikato) on 2009-12-09T15:38:33.000+0000

But problem may be caused no this line: if (class_exists($plugin)) {. Please try the code that I have posted.

Posted by Dolf Schimmel (Freeaqingme) (freak) on 2009-12-09T17:27:14.000+0000

The problem is that if we fixed it by adding a 2nd parameter, other people's code breaks. You appear to rely on the fallback autoloader here, and that's not supported. Please see the issue this one duplicates for more info.

Posted by Dolf Schimmel (Freeaqingme) (freak) on 2009-12-09T17:27:44.000+0000

Closing as duplicate

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