Skip to content

Commit

Permalink
Handle detail key of SoapFault being an object, fixes #1391
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Nov 12, 2019
1 parent cf77550 commit e1af546
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Monolog/Formatter/NormalizerFormatter.php
Expand Up @@ -142,8 +142,8 @@ protected function normalizeException($e)
$data['faultactor'] = $e->faultactor;
}

if (isset($e->detail)) {
$data['detail'] = $e->detail;
if (isset($e->detail) && (is_string($e->detail) || is_object($e->detail) || is_array($e->detail))) {
$data['detail'] = is_string($e->detail) ? $e->detail : reset($e->detail);
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Monolog/Formatter/NormalizerFormatterTest.php
Expand Up @@ -92,7 +92,7 @@ public function testFormatSoapFaultException()
}

$formatter = new NormalizerFormatter('Y-m-d');
$e = new \SoapFault('foo', 'bar', 'hello', 'world');
$e = new \SoapFault('foo', 'bar', 'hello', (object) ['foo' => 'world']);
$formatted = $formatter->format(array(
'exception' => $e,
));
Expand Down

0 comments on commit e1af546

Please sign in to comment.