[
https://issues.apache.org/jira/browse/LOG4PHP-150?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13094419#comment-13094419
]
Vladimir Gorej commented on LOG4PHP-150:
----------------------------------------
LoggerRendererException class is responsible to recursively render exception
chain logged by log4php.
$o is an instance of standard PHP Exception and all it's descendants.
As of version PHP 5.3, Exception API contains method getPrevious().
For more information see:
http://sk2.php.net/manual/en/class.exception.php
http://sk2.php.net/manual/en/language.exceptions.extending.php
This code snippet is responsible for PHP Exception API backward compatibility.
If PHP 5.3 is used and exception carry information of the cause of it's
existence,
it is simply renderer.
if (method_exists($o, 'getPrevious') && $o->getPrevious() !== null) {
$strRep .= PHP_EOL.'Caused by: '.$this->render($o->getPrevious());
}
> getPrevious ObjectMethod being used but does not exist in the code
> ------------------------------------------------------------------
>
> Key: LOG4PHP-150
> URL: https://issues.apache.org/jira/browse/LOG4PHP-150
> Project: Log4php
> Issue Type: Bug
> Components: Code
> Affects Versions: 2.1
> Reporter: Karan Jain
>
> In renderers/LoggerRendererException.php line 34, a call is made to
> $o->getPrevious() whereas this method does not exist. I assume $o is an
> object for LoggerLoggingEvent which does not contain this function.
> I did a search on the trunk as well and did not find this function defined
> anywhere.
> [root@localhost trunk]# find -iname '*.php' | xargs grep 'getPrevious'
> ./src/test/php/renderers/LoggerRendererExceptionTest.php: public
> function getPrevious() {
> ./src/test/php/LoggerThrowableInformationTest.php: public function
> getPrevious() {
> ./src/main/php/renderers/LoggerRendererException.php: if
> (method_exists($o, 'getPrevious') && $o->getPrevious() !== null) {
> ./src/main/php/renderers/LoggerRendererException.php: $strRep
> .= PHP_EOL.'Caused by: '.$this->render($o->getPrevious());
> ./src/main/php/appenders/LoggerAppenderMongoDB.php: if
> (method_exists($ex, 'getPrevious') && $ex->getPrevious() !== null) {
> ./src/main/php/appenders/LoggerAppenderMongoDB.php:
> $array['innerException'] = $this->formatThrowable($ex->getPrevious());
> The code fragment where this is being used is -
> if (method_exists($o, 'getPrevious') && $o->getPrevious() !== null) {
> $strRep .= PHP_EOL.'Caused by:
> '.$this->render($o->getPrevious());
> }
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira