logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ihabu...@apache.org
Subject [2/2] git commit: LOG4PHP-205: Avoid warning when getting location info
Date Sat, 14 Dec 2013 15:56:31 GMT
LOG4PHP-205: Avoid warning when getting location info

debug_backtrace() sometimes does not return 'file' and 'line' values. So
check if they exist before using them.

Signed-off-by: Ivan Habunek <ihabunek@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/logging-log4php/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4php/commit/5fa8da9d
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4php/tree/5fa8da9d
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4php/diff/5fa8da9d

Branch: refs/heads/develop
Commit: 5fa8da9dfc1ea42f125614ffddac322428aa3f56
Parents: 9e9c5f2
Author: Ivan Habunek <ihabunek@apache.org>
Authored: Sat Dec 14 16:49:41 2013 +0100
Committer: Ivan Habunek <ihabunek@apache.org>
Committed: Sat Dec 14 16:49:41 2013 +0100

----------------------------------------------------------------------
 src/main/php/LoggerLoggingEvent.php | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/5fa8da9d/src/main/php/LoggerLoggingEvent.php
----------------------------------------------------------------------
diff --git a/src/main/php/LoggerLoggingEvent.php b/src/main/php/LoggerLoggingEvent.php
index aa0bae7..e826b9c 100644
--- a/src/main/php/LoggerLoggingEvent.php
+++ b/src/main/php/LoggerLoggingEvent.php
@@ -168,8 +168,12 @@ class LoggerLoggingEvent {
 					$className = strtolower($hop['class']);
 					if(!empty($className) and ($className == 'logger' or 
 						strtolower(get_parent_class($className)) == 'logger')) {
-						$locationInfo['line'] = $hop['line'];
-						$locationInfo['file'] = $hop['file'];
+						if (isset($hop['line'])) {
+							$locationInfo['line'] = $hop['line'];
+						}
+						if (isset($hop['file'])) {
+							$locationInfo['file'] = $hop['file'];
+						}
 						break;
 					}
 				}


Mime
View raw message