ZF-3960: Zend_Log_Writer_Firebug breaks CLI app


When running this code from command line (on Windows)

require_once "Zend/Loader.php";

$log = new Zend_Log();
$writerFirebug = new Zend_Log_Writer_Firebug();
$log->log('hi', 2);

It dies with: {quote}Catchable fatal error: Argument 1 passed to Zend_Controller_Plugin_Abstract::setResponse() must be an instance of Zend_Controller_Response_Abstract, null given, called in \library\Zend\Wildfire\Channel\HttpHeaders.php on line 248 and defined in \library\Zend\Controller\Plugin\Abstract.php on line 75{quote}


To make it completely clear:

I have general Log class (writers - Db, Firebug) used in webapp. And I need to run some cron import scripts which should report errors in the Log.

What should likely happen is that if the response object is null, the channel writer should not attempt to instantiate the plugin.

Scheduling for RC3; Christoph, please see my previous comment for a solution.

I can fix the error described, however the intent is to throw an exception if the response object is not initialized to make it clear to the developer that the logged data will not make it into the response likely due to improper initialization. This is the intended behavior for WEB apps.

We have several options to solve this issue:

1) Make it the developer's responsibility to disable the Zend_Wildfire_Plugin_FirePhp component when running in CLI mode


2) Automatically disable the Zend_Wildfire_Plugin_FirePhp component when running in CLI mode

3) Removing the exception altogether to not provide any feedback if the Zend_Wildfire_Plugin_FirePhp component is not properly initialized.

My preference would be option 2.

Any comments?

(2) sounds good to me as well. However, how do you plan on determining that you're running from the CLI?

I was hoping there was a ZF component for that, but I guess not.

How about


Zend_Log_Writer_Firebug is now disabled by default when run from the command line.

If you want to enable it you must use:

$writer = new Zend_Log_Writer_Firebug();

Updating for the 1.6.0 release.