Index: main/main.c =================================================================== RCS file: /repository/php-src/main/main.c,v retrieving revision 1.640.2.23.2.62 diff -u -p -r1.640.2.23.2.62 main.c --- main/main.c 5 Mar 2008 20:58:08 -0000 1.640.2.23.2.62 +++ main/main.c 19 Jun 2008 10:29:23 -0000 @@ -774,17 +774,15 @@ PHPAPI void php_html_puts(const char *st /* {{{ php_suppress_errors */ PHPAPI void php_set_error_handling(error_handling_t error_handling, zend_class_entry *exception_class TSRMLS_DC) { - PG(error_handling) = error_handling; - PG(exception_class) = exception_class; - if (PG(last_error_message)) { - free(PG(last_error_message)); - PG(last_error_message) = NULL; - } - if (PG(last_error_file)) { - free(PG(last_error_file)); - PG(last_error_file) = NULL; + EG(error_handling) = error_handling; + EG(exception_class) = exception_class; + + if (error_handling == EH_NORMAL) { + EG(user_error_handler) = EG(user_error_handler_old); + } else { + EG(user_error_handler_old) = EG(user_error_handler); + EG(user_error_handler) = NULL; } - PG(last_error_lineno) = 0; } /* }}} */ @@ -829,7 +827,7 @@ static void php_error_cb(int type, const } /* according to error handling mode, suppress error, throw exception or show it */ - if (PG(error_handling) != EH_NORMAL) { + if (EG(error_handling) != EH_NORMAL) { switch (type) { case E_ERROR: case E_CORE_ERROR: @@ -849,8 +847,8 @@ static void php_error_cb(int type, const /* throw an exception if we are in EH_THROW mode * but DO NOT overwrite a pending exception */ - if (PG(error_handling) == EH_THROW && !EG(exception)) { - zend_throw_error_exception(PG(exception_class), buffer, 0, type TSRMLS_CC); + if (EG(error_handling) == EH_THROW && !EG(exception)) { + zend_throw_error_exception(EG(exception_class), buffer, 0, type TSRMLS_CC); } efree(buffer); return; @@ -1712,7 +1710,8 @@ int php_module_startup(sapi_module_struc PG(last_error_message) = NULL; PG(last_error_file) = NULL; PG(last_error_lineno) = 0; - PG(error_handling) = EH_NORMAL; + EG(error_handling) = EH_NORMAL; + EG(exception_class) = NULL; PG(disable_functions) = NULL; PG(disable_classes) = NULL; Index: main/php.h =================================================================== RCS file: /repository/php-src/main/php.h,v retrieving revision 1.221.2.4.2.9 diff -u -p -r1.221.2.4.2.9 php.h --- main/php.h 31 Dec 2007 07:20:15 -0000 1.221.2.4.2.9 +++ main/php.h 19 Jun 2008 10:29:24 -0000 @@ -279,12 +279,7 @@ int cfgparse(void); END_EXTERN_C() #define php_error zend_error - -typedef enum { - EH_NORMAL = 0, - EH_SUPPRESS, - EH_THROW -} error_handling_t; +#define error_handling_t zend_error_handling_t BEGIN_EXTERN_C() PHPAPI void php_set_error_handling(error_handling_t error_handling, zend_class_entry *exception_class TSRMLS_DC); Index: main/php_globals.h =================================================================== RCS file: /repository/php-src/main/php_globals.h,v retrieving revision 1.98.2.1.2.8 diff -u -p -r1.98.2.1.2.8 php_globals.h --- main/php_globals.h 31 Dec 2007 07:20:15 -0000 1.98.2.1.2.8 +++ main/php_globals.h 19 Jun 2008 10:29:24 -0000 @@ -150,8 +150,6 @@ struct _php_core_globals { char *last_error_message; char *last_error_file; int last_error_lineno; - error_handling_t error_handling; - zend_class_entry *exception_class; char *disable_functions; char *disable_classes;