dmitry Fri Jun 15 09:20:27 2007 UTC
Modified files: (Branch: PHP_5_2)
/php-src NEWS
/php-src/main main.c
Log:
HTTP 500 is sent to browser in case of PHP error instead of blank page
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.781&r2=1.2027.2.547.2.782&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.781 php-src/NEWS:1.2027.2.547.2.782
--- php-src/NEWS:1.2027.2.547.2.781 Thu Jun 14 23:28:05 2007
+++ php-src/NEWS Fri Jun 15 09:20:26 2007
@@ -1,6 +1,8 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2007, PHP 5.2.4
+- HTTP 500 is sent to browser in case of PHP error instead of blank page.
+ (Dmitry, Andrei Nigmatulin)
- Improved fix for MOPB-03-2007. (Ilia)
- Corrected fix for CVE-2007-2872. (Ilia)
- Enabled statement cache for non-persistent OCI8 connections.
http://cvs.php.net/viewvc.cgi/php-src/main/main.c?r1=1.640.2.23.2.37&r2=1.640.2.23.2.38&diff_format=u
Index: php-src/main/main.c
diff -u php-src/main/main.c:1.640.2.23.2.37 php-src/main/main.c:1.640.2.23.2.38
--- php-src/main/main.c:1.640.2.23.2.37 Fri Jun 15 07:27:08 2007
+++ php-src/main/main.c Fri Jun 15 09:20:27 2007
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: main.c,v 1.640.2.23.2.37 2007/06/15 07:27:08 dmitry Exp $ */
+/* $Id: main.c,v 1.640.2.23.2.38 2007/06/15 09:20:27 dmitry Exp $ */
/* {{{ includes
*/
@@ -834,17 +834,28 @@
/* no break - intentionally */
case E_ERROR:
case E_RECOVERABLE_ERROR:
- /* case E_PARSE: the parser would return 1 (failure), we can
bail out nicely */
+ case E_PARSE:
case E_COMPILE_ERROR:
case E_USER_ERROR:
EG(exit_status) = 255;
if (module_initialized) {
- /* restore memory limit */
- zend_set_memory_limit(PG(memory_limit));
- efree(buffer);
-
zend_objects_store_mark_destructed(&EG(objects_store) TSRMLS_CC);
- zend_bailout();
- return;
+ 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);
+ }
+ /* the parser would return 1 (failure), we can
bail out nicely */
+ if (type != E_PARSE) {
+ /* restore memory limit */
+ zend_set_memory_limit(PG(memory_limit));
+ efree(buffer);
+
zend_objects_store_mark_destructed(&EG(objects_store) TSRMLS_CC);
+ zend_bailout();
+ return;
+ }
}
break;
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php