From 5d2f9d08ee713a2a45da1b803a36ac392f36eaf6 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Wed, 29 Jul 2015 18:26:52 -0700 Subject: [PATCH] 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 --- includes/debug/logger/LegacyLogger.php | 2 +- tests/phpunit/includes/debug/logger/LegacyLoggerTest.php | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) 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( -- 2.20.1