Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Merge pull request #17 from hostnet/master
Browse files Browse the repository at this point in the history
GELFMessage::getAdditional not getting value set by setAdditional
  • Loading branch information
Lennart Koopmann committed Feb 14, 2013
2 parents 9c4affa + d2a2ea5 commit 6e47c56
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 3 additions & 2 deletions GELFMessage.php
Expand Up @@ -221,7 +221,8 @@ public function setAdditional($key, $value) {
* @return mixed
*/
public function getAdditional($key) {
return isset($this->data["_" . trim($key)]) ? $this->data[$key] : null;
$additional_key = "_" . trim($key);
return isset($this->data[$additional_key]) ? $this->data[$additional_key] : null;
}

/**
Expand All @@ -246,4 +247,4 @@ public function toArray() {

return $messageAsArray;
}
}
}
6 changes: 6 additions & 0 deletions tests/GelfMessageTest.php
Expand Up @@ -35,5 +35,11 @@ public function testGelfMessage()
$message->toArray()
);
}

public function testAdditionalField() {
$message = new GELFMessage();
$message->setAdditional("something", "foo");
$this->assertEquals("foo", $message->getAdditional("something"));
}
}

0 comments on commit 6e47c56

Please sign in to comment.