ZF-8509: CLONE -Zend_Application_Bootstrap_BootstrapAbstract::hasResourcePlugin() causes warnings.
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;
}
}
//...
}
Comments
Posted by Hinikato Dubrai (hinikato) on 2009-12-09T15:36:07.000+0000
Please try the following code:
Causes warnings:
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