bug #33632 [ErrorRenderer] fix Cannot use object of type ErrorException as array exception #33631 (k0d3r1s)

This PR was squashed before being merged into the 4.4 branch (closes #33632).

Discussion
----------

[ErrorRenderer] fix Cannot use object of type ErrorException as array exception #33631

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #33631
| License       | MIT

This fixes exception thrown when trying to render ErrorException as an array

Commits
-------

063dc78b49 [ErrorRenderer] fix Cannot use object of type ErrorException as array exception #33631
This commit is contained in:
Fabien Potencier 2019-09-19 16:05:18 +02:00
commit b5ff9966fe

View File

@ -16,7 +16,10 @@
} elseif ($log['priority'] >= 300) {
$status = 'warning';
} else {
$severity = $log['context']['exception']['severity'] ?? false;
$severity = 0;
if (($exception = $log['context']['exception'] ?? null) instanceof \ErrorException) {
$severity = $exception->getSeverity();
}
$status = E_DEPRECATED === $severity || E_USER_DEPRECATED === $severity ? 'warning' : 'normal';
} ?>
<tr class="status-<?= $status; ?>" data-filter-level="<?= strtolower($this->escape($log['priorityName'])); ?>"<?php if ($channelIsDefined) { ?> data-filter-channel="<?= $this->escape($log['channel']); ?>"<?php } ?>>