-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[ErrorHandler] Escape variable in Exception template #35588
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
jderusse
commented
Feb 4, 2020
Q | A |
---|---|
Branch? | 4.4 |
Bug fix? | yes |
New feature? | no |
Deprecations? | no |
Tickets | / |
License | MIT |
Doc PR | / |
} | ||
|
||
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'] ? ')' : ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's remove the extra brackets and add a space after the echo anyway :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the args are escaped (call to strip_tags
), remaining line
which should not contains any html code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nicolas-grekas: from 83f1dca#diff-88463e7f77e3f04a4e60eb807fe6f957L34 I guess the space between echo
and (
keeps being removed (incorrectly) by the CS fixer because of PHP-CS-Fixer/PHP-CS-Fixer#4817 (for which I have already proposed two fixes but...)
Thank you @jderusse. |
…usse) 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 ------- 629d21b Escape variable in Exception Template