#41342 [Opn->Csd]: PHP says syntax errors are 200 OK

From: Date: Thu, 06 Nov 2008 17:54:34 +0000
Subject: #41342 [Opn->Csd]: PHP says syntax errors are 200 OK
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-130717@lists.php.net to get a copy of this message
 ID:               41342
 Updated by:       jani@php.net
 Reported By:      defenestrator at gmail dot com
-Status:           Open
+Status:           Closed
 Bug Type:         Feature/Change Request
 Operating System: FreeBSD
 PHP Version:      5.2.2
 New Comment:

Already happens, as long as display_errors = off.


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

[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



Thread (9 messages)

« previous php.bugs (#130717) next »