From: Etienne Kneuss Date: Fri, 8 Aug 2008 22:06:42 +0000 (+0000) Subject: Fix error_handling usage in various extensions X-Git-Tag: BEFORE_HEAD_NS_CHANGE~806 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b8aa44644d4950c971d3f6ce84b2487ff9fa0855;p=php Fix error_handling usage in various extensions --- diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 4e1867006f..045c20b177 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -2657,11 +2657,10 @@ PHP_METHOD(DateTime, __construct) char *time_str = NULL; int time_str_len = 0; - php_set_error_handling(EH_THROW, NULL TSRMLS_CC); + zend_replace_error_handling(EH_THROW, NULL, NULL TSRMLS_CC); if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sO", &time_str, &time_str_len, &timezone_object, date_ce_timezone)) { date_initialize(zend_object_store_get_object(getThis() TSRMLS_CC), time_str, time_str_len, NULL, timezone_object, 1 TSRMLS_CC); } - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); } /* }}} */ @@ -3360,7 +3359,7 @@ PHP_METHOD(DateTimeZone, __construct) timelib_tzinfo *tzi = NULL; php_timezone_obj *tzobj; - php_set_error_handling(EH_THROW, NULL TSRMLS_CC); + zend_replace_error_handling(EH_THROW, NULL, NULL TSRMLS_CC); if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &tz, &tz_len)) { if (SUCCESS == timezone_initialize(&tzi, tz TSRMLS_CC)) { tzobj = zend_object_store_get_object(getThis() TSRMLS_CC); @@ -3371,7 +3370,6 @@ PHP_METHOD(DateTimeZone, __construct) ZVAL_NULL(getThis()); } } - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); } /* }}} */ @@ -3712,7 +3710,7 @@ PHP_METHOD(DateInterval, __construct) php_interval_obj *diobj; timelib_rel_time *reltime; - php_set_error_handling(EH_THROW, NULL TSRMLS_CC); + zend_replace_error_handling(EH_THROW, NULL, NULL TSRMLS_CC); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &interval_string, &interval_string_length) == SUCCESS) { if (date_interval_initialize(&reltime, interval_string, interval_string_length TSRMLS_CC) == SUCCESS) { diobj = zend_object_store_get_object(getThis() TSRMLS_CC); @@ -3722,7 +3720,6 @@ PHP_METHOD(DateInterval, __construct) ZVAL_NULL(getThis()); } } - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); } /* }}} */ @@ -3866,7 +3863,7 @@ PHP_METHOD(DatePeriod, __construct) int isostr_len = 0; timelib_time *clone; - php_set_error_handling(EH_THROW, NULL TSRMLS_CC); + zend_replace_error_handling(EH_THROW, NULL, NULL TSRMLS_CC); if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "OOl|l", &start, date_ce_date, &interval, date_ce_interval, &recurrences, &options) == FAILURE) { if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "OOO|l", &start, date_ce_date, &interval, date_ce_interval, &end, date_ce_date, &options) == FAILURE) { if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &isostr, &isostr_len, &options) == FAILURE) { @@ -3937,7 +3934,6 @@ PHP_METHOD(DatePeriod, __construct) dpobj->recurrences = recurrences + dpobj->include_start_date; dpobj->initialized = 1; - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); } /* }}} */ diff --git a/ext/dom/attr.c b/ext/dom/attr.c index c71cf51ca6..7647fb2c06 100644 --- a/ext/dom/attr.c +++ b/ext/dom/attr.c @@ -65,13 +65,13 @@ PHP_METHOD(domattr, __construct) dom_object *intern; char *name, *value = NULL; int name_len, value_len, name_valid; + zend_error_handling error_handling; - php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC); + zend_replace_error_handling(EH_THROW, dom_domexception_class_entry, &error_handling TSRMLS_CC); if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os&|s&", &id, dom_attr_class_entry, &name, &name_len, UG(utf8_conv), &value, &value_len, UG(utf8_conv)) == FAILURE) { - php_std_error_handling(); return; } - php_std_error_handling(); + zend_restore_error_handling(&error_handling TSRMLS_CC); intern = (dom_object *)zend_object_store_get_object(id TSRMLS_CC); diff --git a/ext/dom/cdatasection.c b/ext/dom/cdatasection.c index cdae88cd2f..c73dad1978 100644 --- a/ext/dom/cdatasection.c +++ b/ext/dom/cdatasection.c @@ -56,13 +56,13 @@ PHP_METHOD(domcdatasection, __construct) dom_object *intern; char *value = NULL; int value_len; + zend_error_handling error_handling; - php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC); + zend_replace_error_handling(EH_THROW, dom_domexception_class_entry, &error_handling TSRMLS_CC); if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os&", &id, dom_cdatasection_class_entry, &value, &value_len, UG(utf8_conv)) == FAILURE) { - php_std_error_handling(); return; } - php_std_error_handling(); + zend_restore_error_handling(&error_handling TSRMLS_CC); nodep = xmlNewCDataBlock(NULL, (xmlChar *) value, value_len); diff --git a/ext/dom/comment.c b/ext/dom/comment.c index 1f70902cc8..6352a68b6e 100644 --- a/ext/dom/comment.c +++ b/ext/dom/comment.c @@ -56,13 +56,13 @@ PHP_METHOD(domcomment, __construct) dom_object *intern; char *value = NULL; int value_len; + zend_error_handling error_handling; - php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC); + zend_replace_error_handling(EH_THROW, dom_domexception_class_entry, &error_handling TSRMLS_CC); if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|s&", &id, dom_comment_class_entry, &value, &value_len, UG(utf8_conv)) == FAILURE) { - php_std_error_handling(); return; } - php_std_error_handling(); + zend_restore_error_handling(&error_handling TSRMLS_CC); nodep = xmlNewComment((xmlChar *) value); diff --git a/ext/dom/document.c b/ext/dom/document.c index 7efb5b2588..60fcfe3b05 100644 --- a/ext/dom/document.c +++ b/ext/dom/document.c @@ -1503,13 +1503,13 @@ PHP_METHOD(domdocument, __construct) dom_object *intern; char *encoding, *version = NULL; int encoding_len = 0, version_len = 0, refcount; + zend_error_handling error_handling; - php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC); + zend_replace_error_handling(EH_THROW, dom_domexception_class_entry, &error_handling TSRMLS_CC); if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|s&s&", &id, dom_document_class_entry, &version, &version_len, UG(utf8_conv), &encoding, &encoding_len, UG(utf8_conv)) == FAILURE) { - php_std_error_handling(); return; } - php_std_error_handling(); + zend_restore_error_handling(&error_handling TSRMLS_CC); docp = xmlNewDoc(version); diff --git a/ext/dom/documentfragment.c b/ext/dom/documentfragment.c index 3b1c2bd0f0..9675d9d8fc 100644 --- a/ext/dom/documentfragment.c +++ b/ext/dom/documentfragment.c @@ -59,14 +59,14 @@ PHP_METHOD(domdocumentfragment, __construct) zval *id; xmlNodePtr nodep = NULL, oldnode = NULL; dom_object *intern; + zend_error_handling error_handling; - php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC); + zend_replace_error_handling(EH_THROW, dom_domexception_class_entry, &error_handling TSRMLS_CC); if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, dom_documentfragment_class_entry) == FAILURE) { - php_std_error_handling(); return; } - php_std_error_handling(); + zend_restore_error_handling(&error_handling TSRMLS_CC); nodep = xmlNewDocFragment(NULL); if (!nodep) { diff --git a/ext/dom/element.c b/ext/dom/element.c index 019ff19f8e..e744b44f70 100644 --- a/ext/dom/element.c +++ b/ext/dom/element.c @@ -181,13 +181,13 @@ PHP_METHOD(domelement, __construct) int errorcode = 0, uri_len = 0; int name_len, value_len = 0, name_valid; xmlNsPtr nsptr = NULL; + zend_error_handling error_handling; - php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC); + zend_replace_error_handling(EH_THROW, dom_domexception_class_entry, &error_handling TSRMLS_CC); if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os&|s!&s&", &id, dom_element_class_entry, &name, &name_len, UG(utf8_conv), &value, &value_len, UG(utf8_conv), &uri, &uri_len, UG(utf8_conv)) == FAILURE) { - php_std_error_handling(); return; } - php_std_error_handling(); + zend_restore_error_handling(&error_handling TSRMLS_CC); name_valid = xmlValidateName((xmlChar *) name, 0); if (name_valid != 0) { diff --git a/ext/dom/entityreference.c b/ext/dom/entityreference.c index b06407479d..ed871e619c 100644 --- a/ext/dom/entityreference.c +++ b/ext/dom/entityreference.c @@ -56,13 +56,13 @@ PHP_METHOD(domentityreference, __construct) dom_object *intern; char *name; int name_len, name_valid; + zend_error_handling error_handling; - php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC); + zend_replace_error_handling(EH_THROW, dom_domexception_class_entry, &error_handling TSRMLS_CC); if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os&", &id, dom_entityreference_class_entry, &name, &name_len, UG(utf8_conv)) == FAILURE) { - php_std_error_handling(); return; } - php_std_error_handling(); + zend_restore_error_handling(&error_handling TSRMLS_CC); name_valid = xmlValidateName((xmlChar *) name, 0); if (name_valid != 0) { diff --git a/ext/dom/processinginstruction.c b/ext/dom/processinginstruction.c index 8070bd386c..a4c21689f6 100644 --- a/ext/dom/processinginstruction.c +++ b/ext/dom/processinginstruction.c @@ -57,13 +57,13 @@ PHP_METHOD(domprocessinginstruction, __construct) dom_object *intern; char *name, *value = NULL; int name_len, value_len, name_valid; + zend_error_handling error_handling; - php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC); + zend_replace_error_handling(EH_THROW, dom_domexception_class_entry, &error_handling TSRMLS_CC); if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os&|s&", &id, dom_processinginstruction_class_entry, &name, &name_len, UG(utf8_conv), &value, &value_len, UG(utf8_conv)) == FAILURE) { - php_std_error_handling(); return; } - php_std_error_handling(); + zend_restore_error_handling(&error_handling TSRMLS_CC); name_valid = xmlValidateName((xmlChar *) name, 0); if (name_valid != 0) { diff --git a/ext/dom/text.c b/ext/dom/text.c index 1282051b1c..cb61981289 100644 --- a/ext/dom/text.c +++ b/ext/dom/text.c @@ -74,13 +74,13 @@ PHP_METHOD(domtext, __construct) dom_object *intern; char *value = NULL; int value_len; + zend_error_handling error_handling; - php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC); + zend_replace_error_handling(EH_THROW, dom_domexception_class_entry, &error_handling TSRMLS_CC); if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|s&", &id, dom_text_class_entry, &value, &value_len, UG(utf8_conv)) == FAILURE) { - php_std_error_handling(); return; } - php_std_error_handling(); + zend_restore_error_handling(&error_handling TSRMLS_CC); nodep = xmlNewText((xmlChar *) value); diff --git a/ext/dom/xpath.c b/ext/dom/xpath.c index 04d3762cd8..0f363eeb6d 100644 --- a/ext/dom/xpath.c +++ b/ext/dom/xpath.c @@ -275,14 +275,14 @@ PHP_METHOD(domxpath, __construct) dom_object *docobj; dom_xpath_object *intern; xmlXPathContextPtr ctx, oldctx; + zend_error_handling error_handling; - php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC); + zend_replace_error_handling(EH_THROW, dom_domexception_class_entry, &error_handling TSRMLS_CC); if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &id, dom_xpath_class_entry, &doc, dom_document_class_entry) == FAILURE) { - php_std_error_handling(); return; } - php_std_error_handling(); + zend_restore_error_handling(&error_handling TSRMLS_CC); DOM_GET_OBJ(docp, doc, xmlDocPtr, docobj); ctx = xmlXPathNewContext(docp); diff --git a/ext/mysqli/mysqli_driver.c b/ext/mysqli/mysqli_driver.c index 0499c079e4..cc24e202e0 100644 --- a/ext/mysqli/mysqli_driver.c +++ b/ext/mysqli/mysqli_driver.c @@ -82,8 +82,8 @@ static int name(mysqli_object *obj, zval *value TSRMLS_DC) \ static int driver_report_write(mysqli_object *obj, zval *value TSRMLS_DC) { MyG(report_mode) = Z_LVAL_P(value); - php_set_error_handling(MyG(report_mode) & MYSQLI_REPORT_STRICT ? EH_THROW : EH_NORMAL, - zend_exception_get_default(TSRMLS_C) TSRMLS_CC); + /* FIXME */ + zend_replace_error_handling(MyG(report_mode) & MYSQLI_REPORT_STRICT ? EH_THROW : EH_NORMAL, NULL, NULL TSRMLS_CC); return SUCCESS; } /* }}} */ diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index eeb214a215..4e4c0a6283 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -2226,22 +2226,22 @@ PHP_FUNCTION(simplexml_load_string) SimpleXMLElement constructor */ SXE_METHOD(__construct) { - php_sxe_object *sxe = php_sxe_fetch_object(getThis() TSRMLS_CC); - zstr data; - char *ns = NULL; - int data_len, ns_len = 0; - xmlDocPtr docp; - long options = 0; - zend_bool is_url = 0, isprefix = 0; - zend_uchar data_type; - - php_set_error_handling(EH_THROW, zend_exception_get_default(TSRMLS_C) TSRMLS_CC); + php_sxe_object *sxe = php_sxe_fetch_object(getThis() TSRMLS_CC); + zstr data; + char *ns = NULL; + int data_len, ns_len = 0; + xmlDocPtr docp; + long options = 0; + zend_bool is_url = 0, isprefix = 0; + zend_uchar data_type; + zend_error_handling error_handling; + + zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "t|lbs&b", &data, &data_len, &data_type, &options, &is_url, &ns, &ns_len, UG(utf8_conv), &isprefix) == FAILURE) { - php_std_error_handling(); return; } - php_std_error_handling(); + zend_restore_error_handling(&error_handling TSRMLS_CC); if (data_type == IS_UNICODE) { if (is_url) { diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index e3f370f200..91e9f24da8 100755 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -916,7 +916,6 @@ static void spl_array_set_array(zval *object, spl_array_object *intern, zval **a intern->array = *array; } else { if (Z_TYPE_PP(array) != IS_OBJECT && Z_TYPE_PP(array) != IS_ARRAY) { - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); zend_throw_exception(spl_ce_InvalidArgumentException, "Passed variable is not an array or object, using empty array instead", 0 TSRMLS_CC); return; } @@ -935,7 +934,6 @@ static void spl_array_set_array(zval *object, spl_array_object *intern, zval **a zend_object_get_properties_t handler = Z_OBJ_HANDLER_PP(array, get_properties); if ((handler != std_object_handlers.get_properties && handler != spl_array_get_properties) || !spl_array_get_hash_table(intern, 0 TSRMLS_CC)) { - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Overloaded object of type %v is not compatible with %v", Z_OBJCE_PP(array)->name, intern->std.ce->name); } } @@ -990,12 +988,12 @@ SPL_METHOD(Array, __construct) if (ZEND_NUM_ARGS() == 0) { return; /* nothing to do */ } - php_set_error_handling(EH_THROW, spl_ce_InvalidArgumentException TSRMLS_CC); + + zend_replace_error_handling(EH_THROW, spl_ce_InvalidArgumentException, NULL TSRMLS_CC); intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|lC", &array, &ar_flags, &ce_get_iterator) == FAILURE) { - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); return; } @@ -1006,8 +1004,6 @@ SPL_METHOD(Array, __construct) ar_flags &= ~SPL_ARRAY_INT_MASK; spl_array_set_array(object, intern, array, ar_flags, ZEND_NUM_ARGS() == 1 TSRMLS_CC); - - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); } /* }}} */ @@ -1020,7 +1016,6 @@ SPL_METHOD(Array, setIteratorClass) zend_class_entry *ce_get_iterator = zend_ce_iterator; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "C", &ce_get_iterator) == FAILURE) { - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); return; } diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index f3081938da..e61098b192 100755 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -444,7 +444,7 @@ static spl_filesystem_object * spl_filesystem_object_create_info(spl_filesystem_ return NULL; } - php_set_error_handling(EH_THROW, spl_ce_RuntimeException TSRMLS_CC); + zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, NULL TSRMLS_CC); ce = ce ? ce : source->info_class; return_value->value.obj = spl_filesystem_object_new_ex(ce, &intern TSRMLS_CC); @@ -459,8 +459,6 @@ static spl_filesystem_object * spl_filesystem_object_create_info(spl_filesystem_ spl_filesystem_info_set_filename(intern, file_type, file_path, file_path_len, use_copy TSRMLS_CC); } - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); - return intern; } /* }}} */ @@ -469,8 +467,9 @@ static spl_filesystem_object * spl_filesystem_object_create_type(int ht, spl_fil spl_filesystem_object *intern; zend_bool use_include_path = 0; zval *arg1, *arg2; + zend_error_handling error_handling; - php_set_error_handling(EH_THROW, spl_ce_RuntimeException TSRMLS_CC); + zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, &error_handling TSRMLS_CC); switch (source->type) { case SPL_FS_INFO: @@ -479,7 +478,7 @@ static spl_filesystem_object * spl_filesystem_object_create_type(int ht, spl_fil case SPL_FS_DIR: if (!source->u.dir.entry.d_name[0]) { zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Could not open file"); - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); + zend_restore_error_handling(&error_handling TSRMLS_CC); return NULL; } } @@ -532,7 +531,7 @@ static spl_filesystem_object * spl_filesystem_object_create_type(int ht, spl_fil if (ht && zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sbr", &intern->u.file.open_mode, &intern->u.file.open_mode_len, &use_include_path, &intern->u.file.zcontext) == FAILURE) { - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); + zend_restore_error_handling(&error_handling TSRMLS_CC); intern->u.file.open_mode = NULL; zval_dtor(return_value); Z_TYPE_P(return_value) = IS_NULL; @@ -540,7 +539,7 @@ static spl_filesystem_object * spl_filesystem_object_create_type(int ht, spl_fil } if (spl_filesystem_file_open(intern, use_include_path, 0 TSRMLS_CC) == FAILURE) { - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); + zend_restore_error_handling(&error_handling TSRMLS_CC); zval_dtor(return_value); Z_TYPE_P(return_value) = IS_NULL; return NULL; @@ -548,11 +547,11 @@ static spl_filesystem_object * spl_filesystem_object_create_type(int ht, spl_fil } break; case SPL_FS_DIR: - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); + zend_restore_error_handling(&error_handling TSRMLS_CC); zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Operation not supported"); return NULL; } - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); + zend_restore_error_handling(&error_handling TSRMLS_CC); return NULL; } /* }}} */ @@ -672,7 +671,7 @@ void spl_filesystem_object_construct(INTERNAL_FUNCTION_PARAMETERS, int ctor_flag zend_uchar path_type; long flags; - php_set_error_handling(EH_THROW, spl_ce_RuntimeException TSRMLS_CC); + zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, NULL TSRMLS_CC); if (ctor_flags & DIT_CTOR_FLAGS) { flags = SPL_FILE_DIR_KEY_AS_PATHNAME|SPL_FILE_DIR_CURRENT_AS_FILEINFO; @@ -691,11 +690,9 @@ void spl_filesystem_object_construct(INTERNAL_FUNCTION_PARAMETERS, int ctor_flag } if (parsed == FAILURE) { - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); return; } if (!len) { - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Directory name must not be empty."); return; } @@ -715,8 +712,6 @@ void spl_filesystem_object_construct(INTERNAL_FUNCTION_PARAMETERS, int ctor_flag } intern->u.dir.is_recursive = instanceof_function(intern->std.ce, spl_ce_RecursiveDirectoryIterator TSRMLS_CC) ? 1 : 0; - - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); } /* }}} */ @@ -1000,7 +995,7 @@ SPL_METHOD(DirectoryIterator, isDot) /* {{{ proto void SplFileInfo::__construct(string file_name) U Cronstructs a new SplFileInfo from a path. */ -/* php_set_error_handling() is used to throw exceptions in case +/* zend_replace_error_handling() is used to throw exceptions in case the constructor fails. Here we use this to ensure the object has a valid directory resource. @@ -1014,10 +1009,9 @@ SPL_METHOD(SplFileInfo, __construct) int path_len; zend_uchar path_type; - php_set_error_handling(EH_THROW, spl_ce_RuntimeException TSRMLS_CC); + zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, NULL TSRMLS_CC); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "t", &path, &path_len, &path_type) == FAILURE) { - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); return; } @@ -1026,8 +1020,6 @@ SPL_METHOD(SplFileInfo, __construct) spl_filesystem_info_set_filename(intern, path_type, path, path_len, 1 TSRMLS_CC); /* intern->type = SPL_FS_INFO; already set */ - - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); } /* }}} */ @@ -1037,10 +1029,9 @@ SPL_METHOD(SplFileInfo, func_name) \ { \ spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); \ \ - php_set_error_handling(EH_THROW, spl_ce_RuntimeException TSRMLS_CC);\ + zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, NULL TSRMLS_CC);\ spl_filesystem_object_get_file_name(intern TSRMLS_CC); \ php_u_stat(intern->file_name_type, intern->file_name, intern->file_name_len, func_num, FG(default_context), return_value TSRMLS_CC); \ - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);\ } /* }}} */ @@ -1128,7 +1119,7 @@ SPL_METHOD(SplFileInfo, getLinkTarget) int ret, link_len, target_len; char *link, buff[MAXPATHLEN]; - php_set_error_handling(EH_THROW, spl_ce_RuntimeException TSRMLS_CC); + zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, NULL TSRMLS_CC); if (intern->file_name_type == IS_UNICODE) { php_stream_path_encode(NULL, &link, &link_len, intern->file_name.u, intern->file_name_len, REPORT_ERRORS, FG(default_context)); @@ -1159,7 +1150,6 @@ SPL_METHOD(SplFileInfo, getLinkTarget) RETVAL_STRING(buff, 1); } } - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); } /* }}} */ @@ -1173,7 +1163,7 @@ SPL_METHOD(SplFileInfo, getRealPath) int filename_len, path_len; char *filename, buff[MAXPATHLEN]; - php_set_error_handling(EH_THROW, spl_ce_RuntimeException TSRMLS_CC); + zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, NULL TSRMLS_CC); if (intern->type == SPL_FS_DIR && !intern->file_name.v && intern->u.dir.entry.d_name[0]) { spl_filesystem_object_get_file_name(intern TSRMLS_CC); @@ -1211,8 +1201,6 @@ SPL_METHOD(SplFileInfo, getRealPath) if (intern->file_name_type == IS_UNICODE && filename) { efree(filename); } - - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); } /* }}} */ #endif @@ -1233,14 +1221,12 @@ SPL_METHOD(SplFileInfo, setFileClass) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); zend_class_entry *ce = spl_ce_SplFileObject; - - php_set_error_handling(EH_THROW, spl_ce_UnexpectedValueException TSRMLS_CC); + + zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, NULL TSRMLS_CC); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|C", &ce) == SUCCESS) { intern->file_class = ce; } - - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); } /* }}} */ @@ -1250,14 +1236,12 @@ SPL_METHOD(SplFileInfo, setInfoClass) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); zend_class_entry *ce = spl_ce_SplFileInfo; - - php_set_error_handling(EH_THROW, spl_ce_UnexpectedValueException TSRMLS_CC); + + zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, NULL TSRMLS_CC); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|C", &ce) == SUCCESS) { intern->info_class = ce; } - - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); } /* }}} */ @@ -1267,14 +1251,12 @@ SPL_METHOD(SplFileInfo, getFileInfo) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); zend_class_entry *ce = intern->info_class; - - php_set_error_handling(EH_THROW, spl_ce_UnexpectedValueException TSRMLS_CC); + + zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, NULL TSRMLS_CC); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|C", &ce) == SUCCESS) { spl_filesystem_object_create_type(ht, intern, SPL_FS_INFO, ce, return_value TSRMLS_CC); } - - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); } /* }}} */ @@ -1284,8 +1266,8 @@ SPL_METHOD(SplFileInfo, getPathInfo) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); zend_class_entry *ce = intern->info_class; - - php_set_error_handling(EH_THROW, spl_ce_UnexpectedValueException TSRMLS_CC); + + zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, NULL TSRMLS_CC); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|C", &ce) == SUCCESS) { zend_uchar path_type; @@ -1295,8 +1277,6 @@ SPL_METHOD(SplFileInfo, getPathInfo) spl_filesystem_object_create_info(intern, path_type, path, path_len, 1, ce, return_value TSRMLS_CC); } } - - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); } /* }}} */ @@ -2115,7 +2095,7 @@ SPL_METHOD(SplFileObject, __construct) char *tmp_path; int tmp_path_len; - php_set_error_handling(EH_THROW, spl_ce_RuntimeException TSRMLS_CC); + zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, NULL TSRMLS_CC); intern->u.file.open_mode = "r"; intern->u.file.open_mode_len = 1; @@ -2124,7 +2104,6 @@ SPL_METHOD(SplFileObject, __construct) &intern->file_name, &intern->file_name_len, &intern->file_name_type, &intern->u.file.open_mode, &intern->u.file.open_mode_len, &use_include_path, &intern->u.file.zcontext) == FAILURE) { - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); return; } @@ -2156,7 +2135,6 @@ SPL_METHOD(SplFileObject, __construct) intern->_path_type = IS_STRING; } - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); } /* }}} */ /* {{{ proto void SplTempFileObject::__construct([int max_memory]) U @@ -2167,10 +2145,9 @@ SPL_METHOD(SplTempFileObject, __construct) char tmp_fname[48]; spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); - php_set_error_handling(EH_THROW, spl_ce_RuntimeException TSRMLS_CC); + zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, NULL TSRMLS_CC); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &max_memory) == FAILURE) { - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); return; } @@ -2196,8 +2173,6 @@ SPL_METHOD(SplTempFileObject, __construct) intern->_path_len = 0; intern->_path.s = estrndup("", 0); } - - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); } /* }}} */ /* {{{ proto void SplFileObject::rewind() U diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index 23fa15b10c..ce27ee7d7b 100755 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -426,7 +426,7 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla long mode, flags; int inc_refcount = 1; - php_set_error_handling(EH_THROW, spl_ce_InvalidArgumentException TSRMLS_CC); + zend_replace_error_handling(EH_THROW, spl_ce_InvalidArgumentException, NULL TSRMLS_CC); switch(rit_type) { case RIT_RecursiveTreeIterator: { @@ -481,7 +481,6 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla if (iterator && !inc_refcount) { zval_ptr_dtor(&iterator); } - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); zend_throw_exception(spl_ce_InvalidArgumentException, "An instance of RecursiveIterator or IteratorAggregate creating it is required", 0 TSRMLS_CC); return; } @@ -532,7 +531,6 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla intern->iterators[0].ce = ce_iterator; intern->iterators[0].state = RS_START; - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); } /* {{{ proto void RecursiveIteratorIterator::__construct(RecursiveIterator|IteratorAggregate it [, int mode = RIT_LEAVES_ONLY [, int flags = 0]]) throws InvalidArgumentException U @@ -925,11 +923,13 @@ static void spl_recursive_tree_iterator_get_prefix(spl_recursive_it_object *obje static void spl_recursive_tree_iterator_get_entry(spl_recursive_it_object * object, zval * return_value TSRMLS_DC) { zend_object_iterator *iterator = object->iterators[object->level].iterator; - zval **data; + zval **data; + zend_error_handling error_handling; iterator->funcs->get_current_data(iterator, &data TSRMLS_CC); - php_set_error_handling(EH_THROW, spl_ce_UnexpectedValueException TSRMLS_CC); + zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, &error_handling TSRMLS_CC); + RETVAL_ZVAL(*data, 1, 0); if (Z_TYPE_P(return_value) == IS_ARRAY) { zval_dtor(return_value); @@ -937,7 +937,7 @@ static void spl_recursive_tree_iterator_get_entry(spl_recursive_it_object * obje } else if (Z_TYPE_PP(data) != IS_UNICODE && Z_TYPE_PP(data) != IS_STRING) { convert_to_text(return_value); } - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); + zend_restore_error_handling(&error_handling TSRMLS_CC); } static void spl_recursive_tree_iterator_get_postfix(spl_recursive_it_object * object, zval * return_value, zend_uchar return_type TSRMLS_DC) @@ -1302,7 +1302,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z return NULL; } - php_set_error_handling(EH_THROW, spl_ce_InvalidArgumentException TSRMLS_CC); + zend_replace_error_handling(EH_THROW, spl_ce_InvalidArgumentException, NULL TSRMLS_CC); intern->dit_type = dit_type; switch (dit_type) { @@ -1310,16 +1310,13 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z intern->u.limit.offset = 0; /* start at beginning */ intern->u.limit.count = -1; /* get all */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|ll", &zobject, ce_inner, &intern->u.limit.offset, &intern->u.limit.count) == FAILURE) { - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); return NULL; } if (intern->u.limit.offset < 0) { - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); zend_throw_exception(spl_ce_OutOfRangeException, "Parameter offset must be > 0", 0 TSRMLS_CC); return NULL; } if (intern->u.limit.count < 0 && intern->u.limit.count != -1) { - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); zend_throw_exception(spl_ce_OutOfRangeException, "Parameter count must either be -1 or a value greater than or equal 0", 0 TSRMLS_CC); return NULL; } @@ -1329,11 +1326,9 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z case DIT_RecursiveCachingIterator: { long flags = CIT_CALL_TOSTRING; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|l", &zobject, ce_inner, &flags) == FAILURE) { - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); return NULL; } if (spl_cit_check_flags(flags) != SUCCESS) { - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); zend_throw_exception(spl_ce_InvalidArgumentException, "Flags must contain only one of CALL_TOSTRING, TOSTRING_USE_KEY, TOSTRING_USE_CURRENT, TOSTRING_USE_CURRENT", 0 TSRMLS_CC); return NULL; } @@ -1349,7 +1344,6 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z /* UTODO: class_name must be zstr */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|s", &zobject, ce_inner, &class_name, &class_name_len) == FAILURE) { - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); return NULL; } ce = Z_OBJCE_P(zobject); @@ -1360,7 +1354,6 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z || !(*pce_cast)->get_iterator ) { zend_throw_exception(spl_ce_LogicException, "Class to downcast to not found or not base class or does not implement Traversable", 0 TSRMLS_CC); - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); return NULL; } ce = *pce_cast; @@ -1371,12 +1364,10 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z if (retval) { zval_ptr_dtor(&retval); } - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); return NULL; } if (!retval || Z_TYPE_P(retval) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(retval), zend_ce_traversable TSRMLS_CC)) { zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "%v::getIterator() must return an object that implememnts Traversable", ce->name); - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); return NULL; } zobject = retval; @@ -1390,7 +1381,6 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z spl_instantiate(spl_ce_ArrayIterator, &intern->u.append.zarrayit, 1 TSRMLS_CC); zend_call_method_with_0_params(&intern->u.append.zarrayit, spl_ce_ArrayIterator, &spl_ce_ArrayIterator->constructor, "__construct", NULL); intern->u.append.iterator = spl_ce_ArrayIterator->get_iterator(spl_ce_ArrayIterator, intern->u.append.zarrayit, 0 TSRMLS_CC); - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); return intern; #if HAVE_PCRE || HAVE_BUNDLED_PCRE case DIT_RegexIterator: @@ -1404,12 +1394,10 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z intern->u.regex.preg_flags = 0; /* UTODO: do we need tocare if regex unicode? */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Os|lll", &zobject, ce_inner, ®ex, ®ex_len, &mode, &intern->u.regex.flags, &intern->u.regex.preg_flags) == FAILURE) { - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); return NULL; } if (mode < 0 || mode >= REGIT_MODE_MAX) { zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Illegal mode %ld", mode); - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); return NULL; } intern->u.regex.mode = mode; @@ -1417,7 +1405,6 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z intern->u.regex.pce = pcre_get_compiled_regex_cache(ZEND_STR_TYPE, regex, regex_len TSRMLS_CC); if (intern->u.regex.pce == NULL) { /* pcre_get_compiled_regex_cache has already sent error */ - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); return NULL; } intern->u.regex.pce->refcount++; @@ -1426,13 +1413,12 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z #endif default: if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &zobject, ce_inner) == FAILURE) { - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); return NULL; } break; } - php_set_error_handling(EH_THROW, zend_exception_get_default(TSRMLS_C) TSRMLS_CC); + zend_replace_error_handling(EH_THROW, NULL, NULL TSRMLS_CC); if (inc_refcount) { Z_ADDREF_P(zobject); @@ -1442,7 +1428,6 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z intern->inner.object = zend_object_store_get_object(zobject TSRMLS_CC); intern->inner.iterator = intern->inner.ce->get_iterator(intern->inner.ce, zobject, 0 TSRMLS_CC); - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); return intern; } diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c index 7fb6cd83a7..23b35d422c 100755 --- a/ext/spl/spl_observer.c +++ b/ext/spl/spl_observer.c @@ -615,15 +615,12 @@ SPL_METHOD(MultipleIterator, __construct) spl_SplObjectStorage *intern; long flags = MIT_NEED_ALL|MIT_KEYS_NUMERIC; - php_set_error_handling(EH_THROW, spl_ce_InvalidArgumentException TSRMLS_CC); + zend_replace_error_handling(EH_THROW, spl_ce_InvalidArgumentException, NULL TSRMLS_CC); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flags) == FAILURE) { - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); return; } - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); - intern = (spl_SplObjectStorage*)zend_object_store_get_object(getThis() TSRMLS_CC); intern->flags = flags; } diff --git a/ext/sqlite/sqlite.c b/ext/sqlite/sqlite.c index 049eea4d50..0a9a4d7b0b 100644 --- a/ext/sqlite/sqlite.c +++ b/ext/sqlite/sqlite.c @@ -1780,10 +1780,9 @@ PHP_FUNCTION(sqlite_open) zval *errmsg = NULL; zval *object = getThis(); - php_set_error_handling(object ? EH_THROW : EH_NORMAL, sqlite_ce_exception TSRMLS_CC); + zend_replace_error_handling(object ? EH_THROW : EH_NORMAL, sqlite_ce_exception, NULL TSRMLS_CC); if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|lz/", &ppfilename, &mode, &errmsg) || FAILURE == php_stream_path_param_encode(ppfilename, &filename, &filename_len, REPORT_ERRORS, FG(default_context))) { - php_std_error_handling(); return; } if (errmsg) { @@ -1794,7 +1793,6 @@ PHP_FUNCTION(sqlite_open) if (strncmp(filename, ":memory:", sizeof(":memory:") - 1)) { /* resolve the fully-qualified path name to use as the hash key */ if (!(fullpath = expand_filepath(filename, NULL TSRMLS_CC))) { - php_std_error_handling(); if (object) { RETURN_NULL(); } else { @@ -1803,7 +1801,6 @@ PHP_FUNCTION(sqlite_open) } if (php_check_open_basedir(fullpath TSRMLS_CC)) { - php_std_error_handling(); efree(fullpath); if (object) { RETURN_NULL(); @@ -1818,7 +1815,6 @@ PHP_FUNCTION(sqlite_open) if (fullpath) { efree(fullpath); } - php_std_error_handling(); } /* }}} */ @@ -1832,10 +1828,9 @@ PHP_FUNCTION(sqlite_factory) int filename_len; zval *errmsg = NULL; - php_set_error_handling(EH_THROW, sqlite_ce_exception TSRMLS_CC); + zend_replace_error_handling(EH_THROW, sqlite_ce_exception, NULL TSRMLS_CC); if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|lz/", &ppfilename, &mode, &errmsg) || FAILURE == php_stream_path_param_encode(ppfilename, &filename, &filename_len, REPORT_ERRORS, FG(default_context))) { - php_std_error_handling(); RETURN_NULL(); } if (errmsg) { @@ -1846,13 +1841,11 @@ PHP_FUNCTION(sqlite_factory) if (strncmp(filename, ":memory:", sizeof(":memory:") - 1)) { /* resolve the fully-qualified path name to use as the hash key */ if (!(fullpath = expand_filepath(filename, NULL TSRMLS_CC))) { - php_std_error_handling(); RETURN_NULL(); } if (php_check_open_basedir(fullpath TSRMLS_CC)) { efree(fullpath); - php_std_error_handling(); RETURN_NULL(); } } @@ -1861,7 +1854,6 @@ PHP_FUNCTION(sqlite_factory) if (fullpath) { efree(fullpath); } - php_std_error_handling(); } /* }}} */ @@ -2629,11 +2621,11 @@ PHP_FUNCTION(sqlite_fetch_object) zval *retval_ptr; zval *ctor_params = NULL; zend_uchar class_name_type; + zend_error_handling error_handling; - php_set_error_handling(object ? EH_THROW : EH_NORMAL, sqlite_ce_exception TSRMLS_CC); + zend_replace_error_handling(object ? EH_THROW : EH_NORMAL, sqlite_ce_exception, &error_handling TSRMLS_CC); if (object) { if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|tzb", &class_name, &class_name_len, &class_name_type, &ctor_params, &decode_binary)) { - php_std_error_handling(); return; } RES_FROM_OBJECT(res, object); @@ -2644,7 +2636,6 @@ PHP_FUNCTION(sqlite_fetch_object) } } else { if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|tzb", &zres, &class_name, &class_name_len, &class_name_type, &ctor_params, &decode_binary)) { - php_std_error_handling(); return; } ZEND_FETCH_RESOURCE(res, struct php_sqlite_result *, &zres, -1, "sqlite result", le_sqlite_result); @@ -2657,21 +2648,19 @@ PHP_FUNCTION(sqlite_fetch_object) if (!ce) { zend_throw_exception_ex(sqlite_ce_exception, 0 TSRMLS_CC, "Could not find class '%s'", class_name); - php_std_error_handling(); return; } if (res->curr_row < res->nrows) { php_sqlite_fetch_array(res, PHPSQLITE_ASSOC, decode_binary, 1, &dataset TSRMLS_CC); } else { - php_std_error_handling(); RETURN_FALSE; } object_and_properties_init(return_value, ce, NULL); zend_merge_properties(return_value, Z_ARRVAL(dataset), 1 TSRMLS_CC); - php_std_error_handling(); /* before calling the ctor */ + zend_restore_error_handling(&error_handling TSRMLS_CC); if (ce->constructor) { fci.size = sizeof(fci);