From ba1c658b9212f745968d9a016f3c8768f5c6dd6e Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Sun, 5 Apr 2020 19:32:55 +0200 Subject: [PATCH] Escape LegacyDevelopmentTest output --- src/Exceptions/Handlers/LegacyDevelopment.php | 6 ++++++ tests/Unit/Exceptions/Handlers/LegacyDevelopmentTest.php | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Exceptions/Handlers/LegacyDevelopment.php b/src/Exceptions/Handlers/LegacyDevelopment.php index 34c52571..335ce87c 100644 --- a/src/Exceptions/Handlers/LegacyDevelopment.php +++ b/src/Exceptions/Handlers/LegacyDevelopment.php @@ -26,7 +26,13 @@ class LegacyDevelopment extends Legacy 'file' => $file . ':' . $e->getLine(), 'stacktrace' => $this->formatStackTrace($e->getTrace()), ]; + + ob_start(function (string $buffer) { + return htmlspecialchars($buffer); + }); var_dump($data); + ob_end_flush(); + echo ''; } diff --git a/tests/Unit/Exceptions/Handlers/LegacyDevelopmentTest.php b/tests/Unit/Exceptions/Handlers/LegacyDevelopmentTest.php index f7355f76..fb929459 100644 --- a/tests/Unit/Exceptions/Handlers/LegacyDevelopmentTest.php +++ b/tests/Unit/Exceptions/Handlers/LegacyDevelopmentTest.php @@ -19,10 +19,10 @@ class LegacyDevelopmentTest extends TestCase $handler = new LegacyDevelopment(); /** @var Request|MockObject $request */ $request = $this->createMock(Request::class); - $exception = new ErrorException('Lorem Ipsum', 4242, 1, 'foo.php', 9999); + $exception = new ErrorException('Lorem Ipsum', 4242, 1, 'foo.php', 9999); $regex = sprintf( - '%%.*ErrorException.*4242.*Lorem Ipsum.*%s.*%s.*%s.*%%is', + '%%.*ErrorException.*4242.*Lorem <b>Ipsum</b>.*%s.*%s.*%s.*%%is', 'foo.php', 9999, __FUNCTION__