8000 [Debug] Display more details in the simple error page of Debug by javiereguiluz · Pull Request #30024 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Debug] Display more details in the simple error page of Debug #30024

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 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
10000
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[Debug] Display more details in the simple error page of Debug
  • Loading branch information
javiereguiluz authored and nicolas-grekas committed Feb 7, 2019
commit 75ff151580fc41b96581bfa1740f9b65a4787323
2 changes: 1 addition & 1 deletion src/Symfony/Component/Debug/ExceptionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public function getContent(FlattenException $exception)
$title = 'Sorry, the page you are looking for could not be found.';
break;
default:
$title = 'Whoops, looks like something went wrong.';
$title = $this->debug ? $this->escapeHtml($exception->getMessage()) : 'Whoops, looks like something went wrong.';
}

if (!$this->debug) {
Expand Down
11 changes: 10 additions & 1 deletion
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,17 @@ public function testDebug()
$handler->sendPhpResponse(new \RuntimeException('Foo'));
$response = ob_get_clean();

$this->assertContains('Whoops, looks like something went wrong.', $response);
$this->assertContains('<h1 class="break-long-words exception-message">Foo</h1>', $response);
$this->assertContains('<div class="trace trace-as-html">', $response);

// taken from https://www.owasp.org/index.php/Cross-site_Scripting_(XSS)
$htmlWithXss = '<body onload=alert(\'test1\')> <b onmouseover=alert(\'Wufff!\')>click me!</b> <img src="j&#X41vascript:alert(\'test2\')"> <meta http-equiv="refresh"
content="0;url=data:text/html;base64,PHNjcmlwdD5hbGVydCgndGVzdDMnKTwvc2NyaXB0Pg">';
ob_start();
$handler->sendPhpResponse(new \RuntimeException($htmlWithXss));
$response = ob_get_clean();

$this->assertContains(sprintf('<h1 class="break-long-words exception-message">%s</h1>', htmlspecialchars($htmlWithXss, ENT_COMPAT | ENT_SUBSTITUTE, 'UTF-8')), $response);
}

public function testStatusCode()
Expand Down
0