Ver Fonte

Fix support for associative tag arrays, refs #588

Jordi Boggiano há 10 anos atrás
pai
commit
328d66f13f

+ 1 - 1
src/Monolog/Processor/TagProcessor.php

@@ -27,7 +27,7 @@ class TagProcessor
 
     public function addTags(array $tags = array())
     {
-        $this->tags = array_values(array_unique(array_merge($this->tags, $tags)));
+        $this->tags = array_merge($this->tags, $tags);
     }
 
     public function setTags(array $tags = array())

+ 2 - 2
tests/Monolog/Processor/TagProcessorTest.php

@@ -42,8 +42,8 @@ class TagProcessorTest extends TestCase
         $record = $processor($this->getRecord());
         $this->assertEquals(array('a', 'b'), $record['extra']['tags']);
 
-        $processor->addTags(array('a', 'c'));
+        $processor->addTags(array('a', 'c', 'foo' => 'bar'));
         $record = $processor($this->getRecord());
-        $this->assertEquals(array('a', 'b', 'c'), $record['extra']['tags']);
+        $this->assertEquals(array('a', 'b', 'a', 'c', 'foo' => 'bar'), $record['extra']['tags']);
     }
 }