ID:               41342
 Comment by:       php at plummer dot us
 Reported By:      defenestrator at gmail dot com
 Status:           Open
 Bug Type:         Feature/Change Request
 Operating System: FreeBSD
 PHP Version:      5.2.2
 New Comment:

I just want to be able to notify people of errors. With syntax errors,
I can't use php code to do so and the web server doesn't know there's
been a problem when a 200 response is returned so I can't use its error
reporting capabilities. Basically it violates the http rfc to return a
200 on an error response.


Previous Comments:
------------------------------------------------------------------------

[2008-11-30 00:02:19] defenestrator at gmail dot com

I need display_errors on in development environments, which is where
the 200 OK response is causing the inconvenience for me in the first
place. If I make an AJAX request to a PHP file that produces an error,
then I can correct the error but any further requests to the same URL
are pulled out of the browser cache, with no direct way to refresh it.
Many workarounds exist but none should be necessary.

There really isn't any benefit to *not* producing a 500 error here.

------------------------------------------------------------------------

[2008-11-06 17:54:34] j...@php.net

Already happens, as long as display_errors = off.

------------------------------------------------------------------------

[2007-05-09 23:11:30] defenestrator at gmail dot com

Description:
------------
When there is a syntax error in a PHP file, PHP sends back a 200 OK
response without any caching headers. This results in browsers such as
IE or Opera caching the resulting error, which can hinder debugging in
some cases. For example, an XMLHttpRequest to a faulty script can't be
easily force-refreshed from a browser.

I'd prefer for PHP to produce a 500 error in this case. Alternatively,
if you must produce a 200, then sending some headers to inhibit caching
will solve the problem as well.

Reproduce code:
---------------
<?<?>

Expected result:
----------------
HTTP/1.1 500 Internal Server Error
...
Content-Length: 144
Content-Type: text/html

<br />
<b>Parse error</b>:  syntax error, unexpected '<' ...

Actual result:
--------------
HTTP/1.1 200 OK
...
Content-Length: 144
Content-Type: text/html

<br />
<b>Parse error</b>:  syntax error, unexpected '<' ...


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=41342&edit=1

Reply via email to