Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[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

Merged
merged 1 commit into from
Feb 4, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Escape variable in Exception Template
  • Loading branch information
jderusse committed Feb 4, 2020
commit 629d21b800a15dc649fb0ae9ed7cd9211e7e45db
Original file line number Diff line number Diff line change
Expand Up @@ -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'] ? ')' : '');
Copy link
Member

Choose a reason for hiding this comment

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

here too?

Copy link
Member

@nicolas-grekas nicolas-grekas Feb 4, 2020

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 :)

Copy link
Member Author

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

Copy link
Contributor

@guilliamxavier guilliamxavier Apr 1, 2020

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...)

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.