Zend Framework

CLONE -Zend_Application_Bootstrap_BootstrapAbstract::hasResourcePlugin() causes warnings.

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Duplicate
  • Affects Version/s: 1.9.6, 1.10.0
  • Fix Version/s: None
  • Component/s: Zend_Application
  • Labels:
    None

Description

Zend_Application_Bootstrap_BootstrapAbstract::hasResourcePlugin() causes warnings.

See the next code:

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:

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;
                }
            }
        //...
    }

Issue Links

Activity

Hide
Hinikato Dubrai added a comment -

Please try the following code:

$bootstrap = new Zend_Application_Bootstrap_Bootstrap(new Zend_Application('test'));
if ($bootstrap->hasPluginResource('test')) {}

Causes warnings:

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;.;z:/usr/local/php-5.2.8/include') 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.

Show
Hinikato Dubrai added a comment - Please try the following code:
$bootstrap = new Zend_Application_Bootstrap_Bootstrap(new Zend_Application('test'));
if ($bootstrap->hasPluginResource('test')) {}
Causes warnings:
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;.;z:/usr/local/php-5.2.8/include') 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.
Hide
Dolf Schimmel (Freeaqingme) added a comment -

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

Show
Dolf Schimmel (Freeaqingme) added a comment - Since you already noticed it is a duplicate of a non-issue. Do you agree with me to close this issue as 'duplicate'?
Hide
Hinikato Dubrai added a comment -

No, problem still in SVN repositary.

Show
Hinikato Dubrai added a comment - No, problem still in SVN repositary.
Hide
Hinikato Dubrai added a comment -

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

Show
Hinikato Dubrai added a comment - But problem may be caused no this line: if (class_exists($plugin)) {. Please try the code that I have posted.
Hide
Dolf Schimmel (Freeaqingme) added a comment -

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.

Show
Dolf Schimmel (Freeaqingme) added a comment - 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.
Hide
Dolf Schimmel (Freeaqingme) added a comment -

Closing as duplicate

Show
Dolf Schimmel (Freeaqingme) added a comment - Closing as duplicate

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: