Req #72572 [NEW]: Error Reporting on Text-based Web Server
| From: | David at Refoua dot me | Date: | Sun, 10 Jul 2016 20:47:57 +0000 |
| Subject: | Req #72572 [NEW]: Error Reporting on Text-based Web Server | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-202179@lists.php.net to get a copy of this message | ||
From: David at Refoua dot me
Operating system: Any
PHP version: 7.0.8
Package: Unknown/Other Function
Bug Type: Feature/Change Request
Bug description:Error Reporting on Text-based Web Server
Description:
------------
When PHP is used with internal error reporting mechanism, PHP will
determine if the error message is printed on a command-line interface,
or a Web Server (i.e. cgi). All CLI messages are outputted using the
text-only format.
However, this only is desired if the Web Server is only returning a HTML
file. PHP should determine the current header, and if Content-Type is
set to text/plain, or text/*, or anything that a current modern browser
would not interpret as a HTML document, any content produced by HTML
should be formatted for a text-only output.
Therefore, PHP's own error reporting should output the same way CLI
does, when the header's Content-Type is set to text/plain with PHP.
Test script:
---------------
NOTE: This script is called with cgi from a web server, and not from
cli.
<?php
header("Content-Type: text/plain");
abcd(); // An undefined function to produce error
?>
Expected result:
----------------
Fatal error: Uncaught Error: Call to undefined function abcd() in -:1
Stack trace:
#0 {main}
thrown in - on line 1
Actual result:
--------------
<br />
<b>Fatal error</b>: Uncaught Error: Call to undefined function abcd()
in -:1
Stack trace:
#0 {main}
thrown in <b>-</b> on line <b>1</b><br />
--
Edit bug report at https://bugs.php.net/bug.php?id=72572&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72572&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72572&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72572&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=72572&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=72572&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=72572&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=72572&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=72572&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=72572&r=support
Expected behavior: https://bugs.php.net/fix.php?id=72572&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=72572&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=72572&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=72572&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72572&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=72572&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=72572&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=72572&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=72572&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=72572&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=72572&r=mysqlcfg