Author: grobmeier
Date: Wed Nov  4 06:06:22 2009
New Revision: 832662

URL: http://svn.apache.org/viewvc?rev=832662&view=rev
Log:
avoided warning, suggested by Stephane Matamontero- thanks!

Modified:
    incubator/log4php/trunk/src/main/php/LoggerLoggingEvent.php

Modified: incubator/log4php/trunk/src/main/php/LoggerLoggingEvent.php
URL: 
http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/LoggerLoggingEvent.php?rev=832662&r1=832661&r2=832662&view=diff
==============================================================================
--- incubator/log4php/trunk/src/main/php/LoggerLoggingEvent.php (original)
+++ incubator/log4php/trunk/src/main/php/LoggerLoggingEvent.php Wed Nov  4 
06:06:22 2009
@@ -164,13 +164,16 @@
                                // make a downsearch to identify the caller
                                $hop = array_pop($trace);
                                while($hop !== null) {
-                                       $className = strtolower($hop['class']);
-                                       if(!empty($className) and ($className 
== 'logger' or $className == 'loggercategory' or 
-                                               
strtolower(get_parent_class($className)) == 'logger' or
-                                               
strtolower(get_parent_class($className)) == 'loggercategory')) {
-                                               $locationInfo['line'] = 
$hop['line'];
-                                               $locationInfo['file'] = 
$hop['file'];
-                                               break;
+                                       if(isset($hop['class'])) {
+                                               // we are sometimes in 
functions = no class available: avoid php warning here
+                                               $className = 
strtolower($hop['class']);
+                                               if(!empty($className) and 
($className == 'logger' or $className == 'loggercategory' or 
+                                                       
strtolower(get_parent_class($className)) == 'logger' or
+                                                       
strtolower(get_parent_class($className)) == 'loggercategory')) {
+                                                       $locationInfo['line'] = 
$hop['line'];
+                                                       $locationInfo['file'] = 
$hop['file'];
+                                                       break;
+                                               }
                                        }
                                        $prevHop = $hop;
                                        $hop = array_pop($trace);


Reply via email to