From 9144554931ae1186303fe56af76b524806e00418 Mon Sep 17 00:00:00 2001 From: Alex Monk Date: Fri, 9 Oct 2015 17:58:26 +0100 Subject: [PATCH] Handle $frame['function'] not being set in stack frames Bug: T115107 Change-Id: I9fbfcd53fbcba1800a924acb1a1702c3c9037cc5 --- includes/GlobalFunctions.php | 3 +++ includes/exception/MWExceptionHandler.php | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 14327dc848..8fa42e94c6 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -1985,6 +1985,9 @@ function wfGetAllCallers( $limit = 3 ) { * @return string */ function wfFormatStackFrame( $frame ) { + if ( !isset( $frame['function'] ) ) { + return 'NO_FUNCTION_GIVEN'; + } return isset( $frame['class'] ) ? $frame['class'] . '::' . $frame['function'] : $frame['function']; diff --git a/includes/exception/MWExceptionHandler.php b/includes/exception/MWExceptionHandler.php index 4e50070c02..573490222f 100644 --- a/includes/exception/MWExceptionHandler.php +++ b/includes/exception/MWExceptionHandler.php @@ -380,10 +380,12 @@ TXT; $text .= "{$pad}#{$level} [internal function]: "; } - if ( isset( $frame['class'] ) ) { + if ( isset( $frame['class'] ) && isset( $frame['type'] ) && isset( $frame['function'] ) ) { $text .= $frame['class'] . $frame['type'] . $frame['function']; - } else { + } elseif ( isset( $frame['function'] ) ) { $text .= $frame['function']; + } else { + $text .= 'NO_FUNCTION_GIVEN'; } if ( isset( $frame['args'] ) ) { -- 2.20.1