bug #35588 [ErrorHandler] Escape variable in Exception template (jderusse)

This PR was merged into the 4.4 branch.

Discussion
----------

[ErrorHandler] Escape variable in Exception template

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | /
| License       | MIT
| Doc PR        | /

Commits
-------

629d21b800 Escape variable in Exception Template
This commit is contained in:
Fabien Potencier 2020-02-04 11:28:16 +01:00
commit eaec5d67ae

View File

@ -20,15 +20,15 @@
<?php if ($exception['trace']) { ?>
<pre class="stacktrace">
<?php
echo $exception['class'].":\n";
echo $this->escape($exception['class']).":\n";
if ($exception['message']) {
echo $exception['message']."\n";
echo $this->escape($exception['message'])."\n";
}
foreach ($exception['trace'] as $trace) {
echo "\n ";
if ($trace['function']) {
echo 'at '.$trace['class'].$trace['type'].$trace['function'].'('.(isset($trace['args']) ? $this->formatArgsAsText($trace['args']) : '').')';
echo $this->escape('at '.$trace['class'].$trace['type'].$trace['function']).'('.(isset($trace['args']) ? $this->formatArgsAsText($trace['args']) : '').')';
}
if ($trace['file'] && $trace['line']) {
echo($trace['function'] ? "\n (" : 'at ').strtr(strip_tags($this->formatFile($trace['file'], $trace['line'])), [' at line '.$trace['line'] => '']).':'.$trace['line'].($trace['function'] ? ')' : '');