Navigation Menu

Skip to content
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

[ErrorHandler] Escape variable in Exception template #35588

Merged
merged 1 commit into from Feb 4, 2020

Conversation

jderusse
Copy link
Member

@jderusse 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'] ? ')' : '');
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

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

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

@fabpot
Copy link
Member

fabpot commented Feb 4, 2020

Thank you @jderusse.

fabpot added a commit that referenced this pull request Feb 4, 2020
…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
@fabpot fabpot merged commit 629d21b into symfony:4.4 Feb 4, 2020
This was referenced Feb 29, 2020
@jderusse jderusse deleted the fix-escape branch March 5, 2020 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants