Issues

ZF-8424: Zend_Application_Bootstrap_BootstrapAbstract::hasResourcePlugin() causes warnings.

Issue Type: Bug Created: 2009-11-30T00:58:53.000+0000 Last Updated: 2009-11-30T10:03:26.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 Marco Kaiser (bate) on 2009-11-30T03:57:36.000+0000

fixed with r19310

Posted by Matthew Weier O'Phinney (matthew) on 2009-11-30T04:46:41.000+0000

The fix as applied needs to be backed out.

If we pass a boolean false to the second argument of class_exists(), then autoloading is bypassed -- which can be problematic if the developer intended for an autoloader to discover it.

Marco -- please revert your changes, and let me know once you have; I'll look into this issue.

Posted by Marco Kaiser (bate) on 2009-11-30T05:56:37.000+0000

reverted

Posted by Daniel Berstein (danielb) on 2009-11-30T08:56:47.000+0000

On rev 19313 bate introduced a syntax error:

  • if (class_exists($plugin, false)) {
  • if (class_exists($plugin) {

The if statement is missing the closing parenthesis!

Posted by Mickael Perraud (mikaelkael) on 2009-11-30T09:10:25.000+0000

@Daniel Berstein: see ZF-8427 (resolved with r19314)

Posted by Dolf Schimmel (Freeaqingme) (freak) on 2009-11-30T10:03:26.000+0000

Closing as duplicate of ZF-7550. Please mind that fixing this one is a catch-22.

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