ZF-10617: Instanciating Zend_Log_Writer_Firebug using the factory crashes
Description
If you try using the factory to create a new firebug logger like this
Zend_log::factory(array(
array(
"writerName" => "Firebug",
"filterName" => "Priority",
"filterParams" => array(
"priority" => Zend_Log::INFO,
),
),
));
you've got the following fatal error: Fatal error: Cannot redeclare class Zend_Log in PATH/Zend/Log.php on line 30
Using normal instanciation does work though:
$writer = new Zend_Log_Writer_Firebug();
$logger = new Zend_Log($writer);
$logger->log('Test message', Zend_Log::INFO);
Correction is to delete the following lines in Zend/log/Writer/firebug.php (lines 23 and 24) /** Zend_Log */ require_once 'Zend/Log.php';
Comments
Posted by Ramon Henrique Ornelas (ramon) on 2010-10-31T17:18:06.000+0000
In your sample code first the a typo is Zend_Log and not Zend_log. Zend_Log_Writer_Syslog and Zend_Log_Writer_Firebug uses constants of the class Zend_Log by this the require_once.
See a case of error if remove require_once of the class Zend_Log_Writer_Firebug.
Posted by Ramon Henrique Ornelas (ramon) on 2010-10-31T17:46:02.000+0000
Here a simple code reproduced and not found problem.
Please provides more information to reproduced.
Greetings Ramon
Posted by Frédéric MENU (fric) on 2010-10-31T20:17:55.000+0000
Actually you are right the problem comes from the misspelling of Zend_Log. I think that the class loader doesn't register the class properly the first time (using Zend_log) and at the second invocation of the class (using Zend_Log this time) the system crashes because it tries to register the class a second time (but the class loader registered Zend_log not Zend_Log)
Sorry for bothering for nothing and thanks for your reactivity.
Posted by Marc Hodgins (mjh_ca) on 2010-11-23T21:54:20.000+0000
Removing fix version. Issues marked 'not an issue' don't need a fix version.