Skip to content

Commit

Permalink
Also fix SoapFault handling in LineFormatter, refs #1391
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Dec 7, 2019
1 parent 798cbf9 commit 633bcd5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Monolog/Formatter/LineFormatter.php
Expand Up @@ -180,8 +180,8 @@ private function formatException(\Throwable $e): string
$str .= ' faultactor: ' . $e->faultactor;
}

if (isset($e->detail)) {
$str .= ' detail: ' . $e->detail;
if (isset($e->detail) && (is_string($e->detail) || is_object($e->detail) || is_array($e->detail))) {
$str .= ' detail: ' . (is_string($e->detail) ? $e->detail : reset($e->detail));
}
}
$str .= '): ' . $e->getMessage() . ' at ' . $e->getFile() . ':' . $e->getLine() . ')';
Expand Down

3 comments on commit 633bcd5

@pvanoudheusden
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm getting errors on line 183/184. (Object of class stdClass could not be converted to string)
If $e->detail is an object then youre using reset()? Removing the 's_object($e->detail)' works but what to do with objects?

@Seldaek
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reset() is not the problem per se, reset just reads the first public property of the object, the problem is in this case I guess you have a nested object in object, and then it still fails.. anyway this is tracked as #1431

@pvanoudheusden
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thanks for clarification and good to know this is on the radar

Please sign in to comment.