ZF-3960: Zend_Log_Writer_Firebug breaks CLI app

Issue Type: Bug Created: 2008-08-15T11:47:53.000+0000 Last Updated: 2008-09-02T10:39:46.000+0000 Status: Resolved Fix version(s): - 1.6.0 (02/Sep/08)

Reporter: Martin Hujer (mhujer) Assignee: Christoph Dorn (cadorn) Tags: - Zend_Log

  • Zend_Wildfire

Related issues: Attachments:


When running this code from command line (on Windows)

<pre class="highlight">
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}


Posted by Martin Hujer (mhujer) on 2008-08-20T12:41:57.000+0000

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.

Posted by Matthew Weier O'Phinney (matthew) on 2008-08-20T13:08:35.000+0000

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

Posted by Matthew Weier O'Phinney (matthew) on 2008-08-22T15:02:17.000+0000

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

Posted by Christoph Dorn (cadorn) on 2008-08-24T00:01:22.000+0000

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?

Posted by Matthew Weier O'Phinney (matthew) on 2008-08-24T13:32:55.000+0000

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

Posted by Christoph Dorn (cadorn) on 2008-08-24T13:50:47.000+0000

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

How about

<pre class="highlight">

Posted by Christoph Dorn (cadorn) on 2008-08-24T17:47:20.000+0000

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

If you want to enable it you must use:

<pre class="highlight">
$writer = new Zend_Log_Writer_Firebug();

Posted by Wil Sinclair (wil) on 2008-09-02T10:39:46.000+0000

Updating for the 1.6.0 release.

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.