1
1
Fork 0

Merge pull request #10111 from nupplaphil/bug/Logger_Object

Fix Object parsing for Logging
This commit is contained in:
Hypolite Petovan 2021-04-01 16:27:23 -04:00 committed by GitHub
commit 5947698dc1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View file

@ -115,7 +115,7 @@ abstract class AbstractLogger implements LoggerInterface
$output = [];
foreach ($input as $key => $value) {
if (method_exists($value, '__toString')) {
if (is_object($value) && method_exists($value, '__toString')) {
$output[$key] = $value->__toString();
} else {
$output[$key] = $value;

View file

@ -178,4 +178,15 @@ abstract class AbstractLoggerTest extends MockedTest
self::assertContains(@json_encode($assertion), $this->getContent());
}
public function testNoObjectHandling()
{
$logger = $this->getInstance();
$logger->alert('test', ['e' => ['test' => 'test']]);
$text = $this->getContent();
self::assertLogline($text);
self::assertContains('test', $this->getContent());
}
}