Selaa lähdekoodia

Add a test for references normalization

This is an issue in particular when $GLOBALS gets stuck into $context
Nils Adermann 9 vuotta sitten
vanhempi
commit
c582a6e791
1 muutettua tiedostoa jossa 9 lisäystä ja 0 poistoa
  1. 9 0
      tests/Monolog/Formatter/NormalizerFormatterTest.php

+ 9 - 0
tests/Monolog/Formatter/NormalizerFormatterTest.php

@@ -166,6 +166,15 @@ class NormalizerFormatterTest extends \PHPUnit_Framework_TestCase
         $this->assertEquals(@json_encode(array($foo, $bar)), $res);
     }
 
+    public function testCanNormalizeReferences()
+    {
+        $formatter = new NormalizerFormatter();
+        $x = ['foo' => 'bar'];
+        $y = ['x' => &$x];
+        $x['y'] = &$y;
+        $formatter->format($y);
+    }
+
     public function testIgnoresInvalidTypes()
     {
         // set up the recursion