ZF-8531: BootstrapAbstract Emits Warnings That Causes Fatal Error in Certain Resource Setup


When Zend_Application_Bootstrap_BootstrapAbstract::getPluginResource($plugin) tries to find $plugin, it loops through the ini/array specified resource plugins in order, loading them along the way. At the end of the loop it tries a call to class_exists($plugin) to see if it exists (line 354, Zend/Application/Bootstrap/BootstrapAbstract.php). If the class does not exist, a warning is emitted by PHP. (I'm sure whoever's reading this knows all this, just some background).

I have a situation where:

  • a resource plugin needs to be loaded before the FrontController plugin and the Session plugin, and so BootstrapAbstract tries to load it before the session has started.
  • I am testing and have errors and warnings displaying.

The emitted warnings from the failed include call in Zend_Loader (Zend/Loader.php, line 83) caused a fatal error when Zend_Session threw an (uncaught) exception, as the warnings emitted had already gone out to the browser.

I have the errors and warnings displayed so I can smoke em' out, but don't need to know about the class not existing warning, which is crashing everything (the warning itself, not the cause of it).

Given that the warning is just saying "I didn't find it on this loop", and isn't describing any bug in the application, I suppressed the warnings by changing line 354 in BootstrapAbstract to:

if (@class_exists($plugin)) {

I don't know how common this kind of situation will be, but it definitely helps it.


Can you test from current trunk, please? This may no longer be an issue, due to recent changes in trunk.

Also, as a rule, we only allow the suppression operator in very, very exceptional circumstances. It's expensive, and using it can make debugging many issues incredibly difficult. See if current trunk fixes your issues, and please update with the status.

Ins't this a duplicate of ZF-7224 and related to ZF-7550 ?

Hi Matt,

I was away for a while over the holidays and completely forgot when I came back, until I upgraded to 1.9.7. Since I didn't have the problem with 1.9.7, it seems it is in fact fixed.

While I'm sure the Zend Framework survived :), I'm sorry I wasn't able to get back sooner.

Thanks again for all your efforts making ZF better and better (1.10 looks great!).

Isaac -- no worries; I'm glad everything is working for you in 1.9.7!