File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ private function formatExceptionFragment(Throwable $exception): string
4646 /** @var int|string $code */
4747 $ text .= sprintf ("Code: %s \n" , $ code );
4848
49- $ text .= sprintf ("Message: %s \n" , htmlentities ( $ exception ->getMessage () ));
49+ $ text .= sprintf ("Message: %s \n" , $ exception ->getMessage ());
5050
5151 $ text .= sprintf ("File: %s \n" , $ exception ->getFile ());
5252
Original file line number Diff line number Diff line change @@ -202,19 +202,24 @@ public function testXMLErrorRendererRenderHttpException()
202202
203203 public function testPlainTextErrorRendererFormatFragmentMethod ()
204204 {
205- $ exception = new Exception ('Oops.. ' , 500 );
205+ $ message = 'Oops.. <br> ' ;
206+ $ exception = new Exception ($ message , 500 );
206207 $ renderer = new PlainTextErrorRenderer ();
207208 $ reflectionRenderer = new ReflectionClass (PlainTextErrorRenderer::class);
208209
209210 $ method = $ reflectionRenderer ->getMethod ('formatExceptionFragment ' );
210211 $ method ->setAccessible (true );
211212 $ output = $ method ->invoke ($ renderer , $ exception );
213+ $ this ->assertIsString ($ output );
212214
213215 $ this ->assertMatchesRegularExpression ('/.*Type:*/ ' , $ output );
214216 $ this ->assertMatchesRegularExpression ('/.*Code:*/ ' , $ output );
215217 $ this ->assertMatchesRegularExpression ('/.*Message*/ ' , $ output );
216218 $ this ->assertMatchesRegularExpression ('/.*File*/ ' , $ output );
217219 $ this ->assertMatchesRegularExpression ('/.*Line*/ ' , $ output );
220+
221+ // ensure the renderer doesn't reformat the message
222+ $ this ->assertMatchesRegularExpression ("/.* $ message/ " , $ output );
218223 }
219224
220225 public function testPlainTextErrorRendererDisplaysErrorDetails ()
You can’t perform that action at this time.
0 commit comments