php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46510 E_FATAL, E_ERROR should result in HTTP 500
Submitted: 2008-11-06 15:41 UTC Modified: 2008-11-06 17:54 UTC
From: plcplc at gmail dot com Assigned:
Status: Not a bug Package: *Web Server problem
PHP Version: 5.2.6 OS: Debian Linux
Private report: No CVE-ID: None
 [2008-11-06 15:41 UTC] plcplc at gmail dot com
Description:
------------
Currently PHP doesn't tamper with the HTTP error code at all.

It would be nice if errors could trigger the 500 Internal Server Error, because it seems semantically correct.

Also, it would enable programs parsing output (e.g. an AJAX client) to easily identify failure on the server, rather than starting to parse the output to find an error suddenly occuring in the output.

The XMLHttpRequest function commonly used today actually supports calling a user designated function upon HTTP-response codes different from the usual 200 OK, which is why it would be nice to have PHP actually report the error.

Of course, it's not possible to change the header once the headers have been sent, but in many cases they haven't.

Reproduce code:
---------------
foo(); // call an undefined function

Expected result:
----------------
HTTP/1.1 500 Internal Server Error

Actual result:
--------------
HTTP1/1 200 OK

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-11-06 17:54 UTC] jani@php.net
See bug #41342

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 08:01:27 2024 UTC