Dereckson has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/90067


Change subject: Fixes stacktrace output when an internal function is called.
......................................................................

Fixes stacktrace output when an internal function is called.

When a stacktrace call information doesn't contain file and line not
directly available in PHP (see https://bugs.php.net/bug.php?id=64987),
MWException::formatRedactedTrace now prints the information.

This change is a follow-up of I1173216cade73216848816f6bb51e54096abdfde.

Bug: 55479
Bug: 55634
Change-Id: I57e82a75a5147582da83ea24bdcd518dc30e5607
---
M includes/Exception.php
1 file changed, 5 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/67/90067/1

diff --git a/includes/Exception.php b/includes/Exception.php
index fba857f..e95ae5e 100644
--- a/includes/Exception.php
+++ b/includes/Exception.php
@@ -707,10 +707,12 @@
 
                        if ( isset( $call['file'] ) && isset( $call['line'] ) ) 
{
                                $finalExceptionText .= "#{$i} 
{$call['file']}({$call['line']}): ";
-                       } else {
+                       } elseif ( ($file = $e->getFile() ) && ( $line = 
$e->getLine() ) ) {
                                // 'file' and 'line' are unset for calls via 
call_user_func (bug 55634)
-                               // This matches behaviour of 
Exception::getTraceAsString to instead
-                               // display "[internal function]".
+                               $finalExceptionText .= "#{$i} {$file}({$line}): 
";
+                       } else {
+                               // Same case, and no file/line available
+                               // [internal function] is the terminology used 
by Exception::getTraceAsString.
                                $finalExceptionText .= "#{$i} [internal 
function]: ";
                        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/90067
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I57e82a75a5147582da83ea24bdcd518dc30e5607
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Dereckson <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to