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

Issue Type: Bug Created: 2009-12-12T02:01:12.000+0000 Last Updated: 2010-01-20T06:02:40.000+0000 Status: Resolved Fix version(s): - 1.9.7 (11/Jan/10)

Reporter: Isaac F (isac1984) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Application

Related issues: Attachments:


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.


Posted by Matthew Weier O'Phinney (matthew) on 2009-12-14T07:55:36.000+0000

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

Posted by Matthew Weier O'Phinney (matthew) on 2009-12-14T07:56:39.000+0000

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.

Posted by Dolf Schimmel (Freeaqingme) (freak) on 2009-12-14T08:01:20.000+0000

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

Posted by Isaac F (isac1984) on 2010-01-20T00:37:36.000+0000

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!).

Posted by Matthew Weier O'Phinney (matthew) on 2010-01-20T06:02:39.000+0000

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

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.