Преглед изворни кода

Add a test for references normalization

This is an issue in particular when $GLOBALS gets stuck into $context
Nils Adermann пре 9 година
родитељ
комит
c582a6e791
1 измењених фајлова са 9 додато и 0 уклоњено
  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