ZF-11450: Extending Zend_Log_Writer and their factory-methods


If there is any need to extend a writer, for example Firebug to add functionality from FirePHP, you can set a writerNamespace property, e.g.

in an ini-property file:

firebug.writerNamespace = "My_Log_Writer" firebug.writerName = "Firebug"

The Zend_Log::getClassName method works fine, it will recognize the namespace given in $config array, but then call_user_func calls the factory method from Zend_Log_Writer_Firebug and the code there:

public static function factory() { return new self(); }

returns a Zend_Log_Writer_Firebug instance instead of My_Log_Writer_Firebug.

So the factory method must be overridden to take some effect.

solution for php5.3 compatibility is to use return new static, for php5.2 support there is no potential but override the factory method.


No comments to display