ZF-10526: Zend_Controller_Request_Simple and Zend_Db_Profiler_Firebug


When Zend_Controller_Request_Simple is in use[1], and Zend_Db_Profiler_Firebug is enabled in any Zend_Db_Adapter[2], application, trying to log SQL queries via firebug, crashes in nasty way[3]. The reason is that method Zend_Wildfire_Channel_HttpHeaders::isReady() does not make sure if current request object is HTTP one (which is mandatory to log anything through firebug), and one of required methods is missing.

As a quick workaround I made some changes in Zend_Wildfire_Channel_HttpHeaders::isReady() method[4], but I believe there must be a much better way to achieve it. The bug exists (at least) in 1.10.2 and 1.10.8 - those are the versions I tried.

[1] In index.php or any other script starting application: $front->setRequest(new Zend_Controller_Request_Simple(...))

[2] For example in Bootstrap: $profiler = new Zend_Db_Profiler_Firebug; $profiler->setEnabled(true);


[3] The result is: Fatal error: Call to undefined method Zend_Controller_Request_Simple::getHeader() in (...)/Zend/Wildfire/Channel/HttpHeaders.php on line 276

[4] My changes in Zend_Wildfire_Channel_HttpHeaders::isReady() (at the beginning od method's body): if(false === $this->getRequest() instanceof Zend_Controller_Request_Http) { return false; }


Please verify patch before I merge to 1.10 branch.

Looks fine, go ahead.

This fix causes the following strict error: "is_a(): Deprecated. Please use the instanceof operator" to be triggered on PHP < 5.3.

Thanks for the heads up.

See here for discussion:…

I'll implement recommendation once decided.

Christoph: ZF is supposed to run under E_STRICT, which means any method raising an E_DEPRECATED needs to be fixed. Please use "instanceof" in this case -- it takes into account inheritance, and is the proper mechanism.

is_a needs to be fixed.

Using 'instanceof' instead of is_a() now.