From: Alex Monk Date: Fri, 9 Oct 2015 17:20:25 +0000 (+0100) Subject: Use the frame 'type' in wfFormatStackFrame, like MWExceptionHandler::prettyPrintTrace X-Git-Tag: 1.31.0-rc.0~9395 X-Git-Url: http://git.cyclocoop.org/%22.%24h.%22?a=commitdiff_plain;h=23f633c5a6c52008bd044ce15b8ea8a6ab10cb08;p=lhc%2Fweb%2Fwiklou.git Use the frame 'type' in wfFormatStackFrame, like MWExceptionHandler::prettyPrintTrace Instead of assuming '::' Change-Id: I2452bc5ebd3716eb61f53da41a0050f4833fb5a4 --- diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 8fa42e94c6..8f2d43b89c 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -1988,8 +1988,8 @@ function wfFormatStackFrame( $frame ) { if ( !isset( $frame['function'] ) ) { return 'NO_FUNCTION_GIVEN'; } - return isset( $frame['class'] ) ? - $frame['class'] . '::' . $frame['function'] : + return isset( $frame['class'] ) && isset( $frame['type'] ) ? + $frame['class'] . $frame['type'] . $frame['function'] : $frame['function']; } diff --git a/tests/phpunit/includes/GlobalFunctions/wfGetCallerTest.php b/tests/phpunit/includes/GlobalFunctions/wfGetCallerTest.php index bb2b33fe5b..8a7bfa5a8c 100644 --- a/tests/phpunit/includes/GlobalFunctions/wfGetCallerTest.php +++ b/tests/phpunit/includes/GlobalFunctions/wfGetCallerTest.php @@ -6,7 +6,7 @@ */ class WfGetCallerTest extends MediaWikiTestCase { public function testZero() { - $this->assertEquals( __METHOD__, wfGetCaller( 1 ) ); + $this->assertEquals( 'WfGetCallerTest->testZero', wfGetCaller( 1 ) ); } function callerOne() { @@ -14,10 +14,10 @@ class WfGetCallerTest extends MediaWikiTestCase { } public function testOne() { - $this->assertEquals( 'WfGetCallerTest::testOne', self::callerOne() ); + $this->assertEquals( 'WfGetCallerTest->testOne', self::callerOne() ); } - function intermediateFunction( $level = 2, $n = 0 ) { + static function intermediateFunction( $level = 2, $n = 0 ) { if ( $n > 0 ) { return self::intermediateFunction( $level, $n - 1 ); } @@ -26,11 +26,11 @@ class WfGetCallerTest extends MediaWikiTestCase { } public function testTwo() { - $this->assertEquals( 'WfGetCallerTest::testTwo', self::intermediateFunction() ); + $this->assertEquals( 'WfGetCallerTest->testTwo', self::intermediateFunction() ); } public function testN() { - $this->assertEquals( 'WfGetCallerTest::testN', self::intermediateFunction( 2, 0 ) ); + $this->assertEquals( 'WfGetCallerTest->testN', self::intermediateFunction( 2, 0 ) ); $this->assertEquals( 'WfGetCallerTest::intermediateFunction', self::intermediateFunction( 1, 0 ) diff --git a/tests/phpunit/includes/debug/MWDebugTest.php b/tests/phpunit/includes/debug/MWDebugTest.php index 7280a97bd7..3497c88f5d 100644 --- a/tests/phpunit/includes/debug/MWDebugTest.php +++ b/tests/phpunit/includes/debug/MWDebugTest.php @@ -29,7 +29,7 @@ class MWDebugTest extends MediaWikiTestCase { array( array( 'msg' => 'logging a string', 'type' => 'log', - 'caller' => __METHOD__, + 'caller' => 'MWDebugTest->testAddLog', ) ), MWDebug::getLog() );