[PATCH] More error handling changes

From: Date: Wed, 25 Jul 2001 10:42:01 +0000
Subject: [PATCH] More error handling changes
Groups: php.dev 
Request: Send a blank email to php-dev+get-60941@lists.php.net to get a copy of this message
Hi All, To carry on from the XMLRPC Error patch, here is another one that makes PHP bork on parse errors as well as others from an INI directive called break_on_parse. The reason for this is if xmlrpc_errors is on, and PHP throws 2 errors, 2 xmlrpc error packets will be returned, making certain xmlrpc clients (rightfully) spew becasue they have recieved 2 xmlrpc fault packets (xml documents). Cheerio, Matta -- Matt Allen Technical Director Investigation Marketplace 0413 777 771 matt@investigationmarketplace.com

Index: main.c =================================================================== RCS file: /repository/php4/main/main.c,v retrieving revision 1.383 diff -u -r1.383 main.c --- main.c 23 Jul 2001 14:05:26 -0000 1.383 +++ main.c 25 Jul 2001 10:24:24 -0000 @@ -202,6 +202,7 @@ STD_PHP_INI_BOOLEAN("enable_dl", "1", PHP_INI_SYSTEM, OnUpdateBool, enable_dl, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN("expose_php", "1", PHP_INI_SYSTEM, OnUpdateBool, expose_php, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN("html_errors", "1", PHP_INI_SYSTEM, OnUpdateBool, html_errors, php_core_globals, core_globals) + STD_PHP_INI_BOOLEAN("break_on_parse", "0", PHP_INI_SYSTEM, OnUpdateBool, break_on_parse, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN("xmlrpc_errors", "0", PHP_INI_SYSTEM, OnUpdateBool, xmlrpc_errors, php_core_globals, core_globals) STD_PHP_INI_ENTRY("xmlrpc_error_number", "0", PHP_INI_ALL, OnUpdateInt, xmlrpc_error_number, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN("ignore_user_abort", "0", PHP_INI_ALL, OnUpdateBool, ignore_user_abort, php_core_globals, core_globals) @@ -277,7 +278,7 @@ time_t error_time; PLS_FETCH(); - /* Try to use the specified logging location. */ + if (PG(error_log) != NULL) { #ifdef HAVE_SYSLOG_H if (!strcmp(PG(error_log), "syslog")) { @@ -451,7 +452,6 @@ } /* no break - intentionally */ case E_ERROR: - /*case E_PARSE: the parser would return 1 (failure), we can bail out nicely */ case E_COMPILE_ERROR: case E_USER_ERROR: if (module_initialized) { @@ -459,6 +459,13 @@ return; } break; + case E_PARSE: + if (PG(break_on_parse)) { + if (module_initialized) { + zend_bailout(); + return; + } + } } /* Log if necessary */ Index: php_globals.h =================================================================== RCS file: /repository/php4/main/php_globals.h,v retrieving revision 1.68 diff -u -r1.68 php_globals.h --- php_globals.h 17 Jul 2001 16:46:07 -0000 1.68 +++ php_globals.h 25 Jul 2001 10:24:25 -0000 @@ -127,7 +127,7 @@ zend_bool xmlrpc_errors; long xmlrpc_error_number; - + zend_bool break_on_parse; zend_bool modules_activated;
« previous php.dev (#60941) next »