|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42722 display_errors setting ignored for E_PARSE and HTTP 500 page
Submitted: 2007-09-21 02:22 UTC Modified: 2007-10-22 10:45 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: mabismad at msn dot com Assigned: dmitry (profile)
Status: Closed Package: *General Issues
PHP Version: 5.2.4 OS: WinXP
Private report: No CVE-ID: None
 [2007-09-21 02:22 UTC] mabismad at msn dot com
The display errors and error reporting change to accomplish the following - "Changed error handler to send HTTP 500 instead of blank page on PHP errors. (Dmitry, Andrei Nigmatulin)" - apparently does not check if there is actual output due to the display errors/error reporting settings.

When display_errors is set to On and error_reporting is set to E_ALL, only Notice and Warning level messages are output to the browser. Fatal parse errors (and probably other types) unconditionally cause a HTTP 500 page.

The HTTP 500 redirect should only occur when there is absolutely no actual output from any of the display errors/error reporting settings.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-09-30 21:37 UTC]
Dmitry, please check this out.
 [2007-10-01 10:48 UTC]
I cannot reproduce it with CVS version.

$ sapi/cgi/php-cgi -d display_errors=0 -d error_reporting=E_ALL wrong.php
Status: 500 Internal Server Error
X-Powered-By: PHP/5.3.0-dev
Content-type: text/html

$ sapi/cgi/php-cgi -d display_errors=1 -d error_reporting=E_ALL wrong.php
X-Powered-By: PHP/5.3.0-dev
Content-type: text/html

<br />
<b>Parse error</b>:  syntax error, unexpected T_STRING in <b>/home/dmitry/php/php5.3/CGI-DEBUG/x.php</b> on line <b>2</b><br />
/home/dmitry/php/php5.3/CGI-DEBUG/wrong.php(2) : Parse error - syntax error, unexpected T_STRING

 [2007-10-03 10:19 UTC] alahaye at fm2i dot com
Is the same for me with PHP 5.2.4 for a development server :

Here my php.ini configuration :

error_reporting  =  E_ALL & ~E_NOTICE
display_errors = On
log_errors = On
error_log = /var/log/php/php_error.log

With this simple code :

  print "Hello world;


I get on screen : HTTP 500 internal error
Error is log on my file /var/log/php/php_error.log
BUT no error display on screen (expected is : PHP Parse error:  syntax error, unexpected $end in error.php on line X)

Can you give us more information about "Changed error handler to send HTTP 500 instead of blank page on PHP errors."

How to display error on browser like in previous version. When you are 10 developper on the server and don't have access to the Apache log file it's not usefull.

 [2007-10-09 08:00 UTC] dan at yes dot lt
this bug still was not fixed
 [2007-10-18 13:12 UTC]
The behavior was probably related to output_buffering setting.
Now it should be fixed in CVS HEAD, PHP_5_3 and PHP_5_2.

Please cheack and close or reopen the bug.
 [2007-10-19 13:47 UTC] mabismad at msn dot com
Yes. Turning off output buffering in php.ini/.htaccess (it is on by default when using php.ini-recommended settings) corrects the symptom.

That would indicate that when a script terminates in the error handling processing, that the output buffer is not flushed in the same way it is when the script reaches the normal end of file processing.
 [2007-10-22 10:45 UTC]
As Dmitry said, this is fixed in CVS.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jul 13 14:01:30 2024 UTC