php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #77075 Add <br> to the exception reporting in HTML
Submitted: 2018-10-27 19:16 UTC Modified: 2021-04-07 19:00 UTC
From: david at grudl dot com Assigned:
Status: Re-Opened Package: Output Control
PHP Version: 7.3.0RC4 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: david at grudl dot com
New email:
PHP Version: OS:

 

 [2018-10-27 19:16 UTC] david at grudl dot com
Description:
------------
When an undefined exception with a callstack is printed in browser, it would be handy to use nl2br() for output to make the callstack more readable.



Expected result:
----------------
Fatal error: Uncaught Exception: The my exception in test.php:36
Stack trace:
#0 test.php(30): DemoClass::third(Array)
#1 test.php(24): DemoClass->second(true, false)
#2 test.php(44): DemoClass->first(10, 'any string')
#3 test.php(52): demo(10, 'any string')
#4 {main} thrown in test.php on line 36

Actual result:
--------------
Current output in HTML:
Fatal error: Uncaught Exception: The my exception in test.php:36 Stack trace: #0 test.php(30): DemoClass::third(Array) #1 test.php(24): DemoClass->second(true, false) #2 test.php(44): DemoClass->first(10, 'any string') #3 test.php(52): demo(10, 'any string') #4 {main} thrown in test.php on line 36

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-04-06 15:12 UTC] cmb@php.net
-Status: Open +Status: Wont fix -Assigned To: +Assigned To: cmb
 [2021-04-06 15:12 UTC] cmb@php.net
I don't think addressing this particular case makes sense; other
debug output (var_dump() etc.) has the same issue.  You can use
Xdebug to "fix" that.

If you feel strongly that this should be implemented, please
pursue the RFC process[1].

[1] <https://wiki.php.net/rfc/howto>
 [2021-04-07 17:37 UTC] david at grudl dot com
It is not related to var_dump() etc. 

Point is that error in PHP is printed this way:

------
<br />
<b>Fatal error</b>:  Uncaught Error: Call to undefined function x() in file.php:5
Stack trace:
#0 {main}
  thrown in <b>file.php</b> on line <b>5</b><br />
----

I just suggest that it would be print like this:


------
<br />
<b>Fatal error</b>:  Uncaught Error: Call to undefined function x() in file.php:5<br>
Stack trace:<br>
#0 {main}<br>
  thrown in <b>file.php</b> on line <b>5</b><br />
----

Please, reopen it.
 [2021-04-07 17:48 UTC] rtrtrtrtrt at dfdfdfdf dot dfd
in other words expetions should respect "html_errors" as other errors, case closed, it's that simple
 [2021-04-07 19:00 UTC] cmb@php.net
-Status: Wont fix +Status: Re-Opened -Assigned To: cmb +Assigned To:
 [2021-04-07 19:00 UTC] cmb@php.net
Well, then …
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Apr 12 22:01:23 2021 UTC