logger: Fix undefined variable $data
authorTimo Tijhof <krinklemail@gmail.com>
Thu, 30 Jul 2015 01:26:52 +0000 (18:26 -0700)
committerTimo Tijhof <krinklemail@gmail.com>
Thu, 30 Jul 2015 01:26:52 +0000 (18:26 -0700)
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
tests/phpunit/includes/debug/logger/LegacyLoggerTest.php

index ea4e1b1..831ad1b 100644 (file)
@@ -343,7 +343,7 @@ class LegacyLogger extends AbstractLogger {
                        if ( is_nan( $item ) ) {
                                return 'NaN';
                        }
-                       return $data;
+                       return $item;
                }
 
                if ( is_scalar( $item ) ) {
index c63ce66..1b3ce2c 100644 (file)
@@ -84,6 +84,13 @@ class LegacyLoggerTest extends MediaWikiTestCase {
                                ),
                                'true',
                        ),
+                       array(
+                               '{float}',
+                               array(
+                                       'float' => 1.23,
+                               ),
+                               '1.23',
+                       ),
                        array(
                                '{array}',
                                array(