From: Timo Tijhof Date: Thu, 30 Jul 2015 01:26:52 +0000 (-0700) Subject: logger: Fix undefined variable $data X-Git-Tag: 1.31.0-rc.0~10585^2 X-Git-Url: http://git.cyclocoop.org/%22.%24redirect_annul.%22?a=commitdiff_plain;h=5d2f9d08ee713a2a45da1b803a36ac392f36eaf6;p=lhc%2Fweb%2Fwiklou.git logger: Fix undefined variable $data Follows-up 77a397125f. Also add unit test that would've caught this "PHP Notice: Undefined variable: data" error. Change-Id: I8a3bd9c8b685c2aa7a466e3d3c61ffa027be02fa --- diff --git a/includes/debug/logger/LegacyLogger.php b/includes/debug/logger/LegacyLogger.php index ea4e1b1413..831ad1b425 100644 --- a/includes/debug/logger/LegacyLogger.php +++ b/includes/debug/logger/LegacyLogger.php @@ -343,7 +343,7 @@ class LegacyLogger extends AbstractLogger { if ( is_nan( $item ) ) { return 'NaN'; } - return $data; + return $item; } if ( is_scalar( $item ) ) { diff --git a/tests/phpunit/includes/debug/logger/LegacyLoggerTest.php b/tests/phpunit/includes/debug/logger/LegacyLoggerTest.php index c63ce66d49..1b3ce2ca61 100644 --- a/tests/phpunit/includes/debug/logger/LegacyLoggerTest.php +++ b/tests/phpunit/includes/debug/logger/LegacyLoggerTest.php @@ -84,6 +84,13 @@ class LegacyLoggerTest extends MediaWikiTestCase { ), 'true', ), + array( + '{float}', + array( + 'float' => 1.23, + ), + '1.23', + ), array( '{array}', array(