ID: 43177
User updated by: taneli at crasman dot fi
Reported By: taneli at crasman dot fi
Status: Open
Bug Type: Feature/Change Request
Operating System: Linux
PHP Version: 5.2.4
New Comment:
Here's a patch for this issue:
--- php-5.2.4-vanilla/main/main.c 2007-11-01 15:20:37.000000000
+0200
+++ php-5.2.4/main/main.c 2007-11-01 17:26:45.000000000 +0200
@@ -957,11 +957,15 @@
if (!SG(headers_sent) &&
SG(sapi_headers).http_response_code == 200
) {
- sapi_header_line ctr = {0};
-
- ctr.line = "HTTP/1.0 500
Internal Server Error";
- ctr.line_len =
strlen(ctr.line);
-
sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC);
+ if (!EG(current_execute_data)
||
+
!EG(current_execute_data)->opline ||
+
EG(current_execute_data)->opline->opcode != ZEND_INCLUDE_OR_EVAL) {
+ sapi_header_line ctr =
{0};
+
+ ctr.line = "HTTP/1.0
500 Internal Server Error";
+ ctr.line_len =
strlen(ctr.line);
+
sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC);
+ }
}
/* the parser would return 1 (failure),
we can bail out nicely */
if (type != E_PARSE) {
Previous Comments:
------------------------------------------------------------------------
[2007-11-02 11:41:44] taneli at crasman dot fi
Description:
------------
Errors in eval()'ed code produces HTTP status code 500 for the request.
Reproduce code:
---------------
Script:
<?php {
eval("this is not right");
}?>
Result:
# curl -I http://localhost/test.php
HTTP/1.0 500 Internal Server Error
Expected result:
----------------
Since parse errors and such in eval()'ed code don't interrupt the
script or make it bail out, I think 200 would be a more approriate
code.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43177&edit=1