summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/date/php_date.c13
-rw-r--r--ext/dom/attr.c6
-rw-r--r--ext/dom/cdatasection.c6
-rw-r--r--ext/dom/comment.c6
-rw-r--r--ext/dom/document.c6
-rw-r--r--ext/dom/documentfragment.c6
-rw-r--r--ext/dom/element.c6
-rw-r--r--ext/dom/entityreference.c6
-rw-r--r--ext/dom/processinginstruction.c6
-rw-r--r--ext/dom/text.c6
-rw-r--r--ext/dom/xpath.c6
-rw-r--r--ext/mysqli/mysqli_driver.c4
-rw-r--r--ext/simplexml/simplexml.c6
-rwxr-xr-xext/spl/spl_array.c10
-rwxr-xr-xext/spl/spl_directory.c63
-rwxr-xr-xext/spl/spl_iterators.c30
-rwxr-xr-xext/spl/spl_observer.c5
-rw-r--r--ext/sqlite/sqlite.c21
18 files changed, 75 insertions, 137 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index ffa6116804..390dd5d590 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -2519,11 +2519,11 @@ 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);
}
/* }}} */
@@ -3193,7 +3193,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);
@@ -3204,7 +3204,6 @@ PHP_METHOD(DateTimeZone, __construct)
ZVAL_NULL(getThis());
}
}
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
}
/* }}} */
@@ -3537,7 +3536,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);
@@ -3547,7 +3546,6 @@ PHP_METHOD(DateInterval, __construct)
ZVAL_NULL(getThis());
}
}
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
}
/* }}} */
@@ -3691,7 +3689,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) {
@@ -3762,7 +3760,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 dafdc0929b..8512f14ec5 100644
--- a/ext/dom/attr.c
+++ b/ext/dom/attr.c
@@ -65,14 +65,14 @@ 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, &value, &value_len) == 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);
name_valid = xmlValidateName((xmlChar *) name, 0);
diff --git a/ext/dom/cdatasection.c b/ext/dom/cdatasection.c
index fe5614e492..5fcffb867f 100644
--- a/ext/dom/cdatasection.c
+++ b/ext/dom/cdatasection.c
@@ -56,14 +56,14 @@ 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) == 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);
if (!nodep) {
diff --git a/ext/dom/comment.c b/ext/dom/comment.c
index c754a4d7a8..9ec528d8c8 100644
--- a/ext/dom/comment.c
+++ b/ext/dom/comment.c
@@ -56,14 +56,14 @@ 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) == FAILURE) {
- php_std_error_handling();
return;
}
- php_std_error_handling();
+ zend_restore_error_handling(&error_handling TSRMLS_CC);
nodep = xmlNewComment((xmlChar *) value);
if (!nodep) {
diff --git a/ext/dom/document.c b/ext/dom/document.c
index f541d7b80a..1bd244c9ae 100644
--- a/ext/dom/document.c
+++ b/ext/dom/document.c
@@ -1501,14 +1501,14 @@ 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|ss", &id, dom_document_class_entry, &version, &version_len, &encoding, &encoding_len) == FAILURE) {
- php_std_error_handling();
return;
}
- php_std_error_handling();
+ zend_restore_error_handling(&error_handling TSRMLS_CC);
docp = xmlNewDoc(version);
if (!docp) {
diff --git a/ext/dom/documentfragment.c b/ext/dom/documentfragment.c
index acfe2e5f6f..326ae7145c 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 a8a1e126d6..0f7a410fa0 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, &value, &value_len, &uri, &uri_len) == 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 26236cd05e..6cf94356c1 100644
--- a/ext/dom/entityreference.c
+++ b/ext/dom/entityreference.c
@@ -56,14 +56,14 @@ 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) == 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 9178e8e528..4edb6bc28c 100644
--- a/ext/dom/processinginstruction.c
+++ b/ext/dom/processinginstruction.c
@@ -57,14 +57,14 @@ 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, &value, &value_len) == 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 1f9f67eecd..c631aec170 100644
--- a/ext/dom/text.c
+++ b/ext/dom/text.c
@@ -74,14 +74,14 @@ 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) == FAILURE) {
- php_std_error_handling();
return;
}
- php_std_error_handling();
+ zend_restore_error_handling(&error_handling TSRMLS_CC);
nodep = xmlNewText((xmlChar *) value);
if (!nodep) {
diff --git a/ext/dom/xpath.c b/ext/dom/xpath.c
index 9fa2b30091..a5d9b4c770 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 4cbe668772..bc803e1d20 100644
--- a/ext/mysqli/mysqli_driver.c
+++ b/ext/mysqli/mysqli_driver.c
@@ -78,8 +78,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 91d2a7ad90..7c4809cec3 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -2176,14 +2176,14 @@ SXE_METHOD(__construct)
xmlDocPtr docp;
long options = 0;
zend_bool is_url = 0, isprefix = 0;
+ zend_error_handling error_handling;
- php_set_error_handling(EH_THROW, zend_exception_get_default(TSRMLS_C) TSRMLS_CC);
+ zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lbsb", &data, &data_len, &options, &is_url, &ns, &ns_len, &isprefix) == FAILURE) {
- php_std_error_handling();
return;
}
- php_std_error_handling();
+ zend_restore_error_handling(&error_handling TSRMLS_CC);
docp = is_url ? xmlReadFile(data, NULL, options) : xmlReadMemory(data, data_len, NULL, NULL, options);
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index 653a6a785a..ca4f2afc9f 100755
--- a/ext/spl/spl_array.c
+++ b/ext/spl/spl_array.c
@@ -909,7 +909,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;
}
@@ -928,7 +927,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 %s is not compatible with %s", Z_OBJCE_PP(array)->name, intern->std.ce->name);
}
}
@@ -985,19 +983,18 @@ 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|ls", &array, &ar_flags, &class_name, &class_name_len) == FAILURE) {
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
return;
}
if (ZEND_NUM_ARGS() > 2) {
if (zend_lookup_class(class_name, class_name_len, &pce_get_iterator TSRMLS_CC) == FAILURE) {
zend_throw_exception(spl_ce_InvalidArgumentException, "A class that implements Iterator must be specified", 0 TSRMLS_CC);
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
return;
}
intern->ce_get_iterator = *pce_get_iterator;
@@ -1007,7 +1004,6 @@ SPL_METHOD(Array, __construct)
spl_array_set_array(object, intern, array, ar_flags, ZEND_NUM_ARGS() == 1 TSRMLS_CC);
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
}
/* }}} */
@@ -1022,13 +1018,11 @@ SPL_METHOD(Array, setIteratorClass)
zend_class_entry ** pce_get_iterator;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &class_name, &class_name_len) == FAILURE) {
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
return;
}
if (zend_lookup_class(class_name, class_name_len, &pce_get_iterator TSRMLS_CC) == FAILURE) {
zend_throw_exception(spl_ce_InvalidArgumentException, "A class that implements Iterator must be specified", 0 TSRMLS_CC);
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
return;
}
intern->ce_get_iterator = *pce_get_iterator;
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c
index 752a3e5451..84aad7f7b3 100755
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@ -391,7 +391,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);
@@ -406,8 +406,6 @@ static spl_filesystem_object * spl_filesystem_object_create_info(spl_filesystem_
spl_filesystem_info_set_filename(intern, file_path, file_path_len, use_copy TSRMLS_CC);
}
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
-
return intern;
} /* }}} */
@@ -416,8 +414,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:
@@ -426,7 +425,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;
}
}
@@ -477,7 +476,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;
@@ -485,7 +484,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;
@@ -493,11 +492,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;
} /* }}} */
@@ -605,7 +604,7 @@ void spl_filesystem_object_construct(INTERNAL_FUNCTION_PARAMETERS, int ctor_flag
int parsed, len;
long flags;
- php_set_error_handling(EH_THROW, spl_ce_UnexpectedValueException TSRMLS_CC);
+ zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, NULL TSRMLS_CC);
if (ctor_flags & DIT_CTOR_FLAGS) {
flags = SPL_FILE_DIR_KEY_AS_PATHNAME|SPL_FILE_DIR_CURRENT_AS_FILEINFO;
@@ -621,11 +620,9 @@ void spl_filesystem_object_construct(INTERNAL_FUNCTION_PARAMETERS, int ctor_flag
flags |= SPL_FILE_DIR_UNIXPATHS;
}
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;
}
@@ -642,7 +639,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);
}
/* }}} */
@@ -905,7 +901,7 @@ SPL_METHOD(DirectoryIterator, isDot)
/* {{{ proto void SplFileInfo::__construct(string file_name)
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.
@@ -918,10 +914,9 @@ SPL_METHOD(SplFileInfo, __construct)
char *path;
int len;
- 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, "s", &path, &len) == FAILURE) {
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
return;
}
@@ -930,8 +925,6 @@ SPL_METHOD(SplFileInfo, __construct)
spl_filesystem_info_set_filename(intern, path, len, 1 TSRMLS_CC);
/* intern->type = SPL_FS_INFO; already set */
-
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
}
/* }}} */
@@ -941,10 +934,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_stat(intern->file_name, intern->file_name_len, func_num, return_value TSRMLS_CC); \
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);\
}
/* }}} */
@@ -1031,7 +1023,7 @@ SPL_METHOD(SplFileInfo, getLinkTarget)
int ret;
char 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);
#ifdef HAVE_SYMLINK
ret = readlink(intern->file_name, buff, MAXPATHLEN-1);
@@ -1048,7 +1040,6 @@ SPL_METHOD(SplFileInfo, getLinkTarget)
RETVAL_STRINGL(buff, ret, 1);
}
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
}
/* }}} */
@@ -1061,7 +1052,7 @@ SPL_METHOD(SplFileInfo, getRealPath)
char buff[MAXPATHLEN];
char *filename;
- 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 && intern->u.dir.entry.d_name[0]) {
spl_filesystem_object_get_file_name(intern TSRMLS_CC);
@@ -1084,7 +1075,6 @@ SPL_METHOD(SplFileInfo, getRealPath)
} else {
RETVAL_FALSE;
}
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
}
/* }}} */
#endif
@@ -1106,13 +1096,11 @@ 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);
}
/* }}} */
@@ -1123,13 +1111,11 @@ 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);
}
/* }}} */
@@ -1140,13 +1126,11 @@ 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);
}
/* }}} */
@@ -1157,7 +1141,7 @@ 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) {
int path_len;
@@ -1166,8 +1150,6 @@ SPL_METHOD(SplFileInfo, getPathInfo)
spl_filesystem_object_create_info(intern, path, path_len, 1, ce, return_value TSRMLS_CC);
}
}
-
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
}
/* }}} */
@@ -1967,7 +1949,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;
@@ -1976,7 +1958,6 @@ SPL_METHOD(SplFileObject, __construct)
&intern->file_name, &intern->file_name_len,
&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;
}
@@ -2006,7 +1987,6 @@ SPL_METHOD(SplFileObject, __construct)
intern->_path = estrndup(intern->u.file.stream->orig_path, intern->_path_len);
}
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
} /* }}} */
/* {{{ proto void SplTempFileObject::__construct([int max_memory])
@@ -2017,10 +1997,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;
}
@@ -2042,8 +2021,6 @@ SPL_METHOD(SplTempFileObject, __construct)
intern->_path_len = 0;
intern->_path = estrndup("", 0);
}
-
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
} /* }}} */
/* {{{ proto void SplFileObject::rewind()
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index 82ad3e0f34..10426c3192 100755
--- a/ext/spl/spl_iterators.c
+++ b/ext/spl/spl_iterators.c
@@ -425,7 +425,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: {
@@ -480,7 +480,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;
}
@@ -531,7 +530,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
@@ -918,11 +916,12 @@ 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);
@@ -930,7 +929,7 @@ static void spl_recursive_tree_iterator_get_entry(spl_recursive_it_object * obje
} else {
convert_to_string(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 TSRMLS_DC)
@@ -1251,7 +1250,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) {
@@ -1259,16 +1258,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;
}
@@ -1278,11 +1274,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;
}
@@ -1297,7 +1291,6 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
int class_name_len;
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);
@@ -1308,7 +1301,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;
@@ -1319,12 +1311,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, "%s::getIterator() must return an object that implememnts Traversable", ce->name);
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
return NULL;
}
zobject = retval;
@@ -1338,7 +1328,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:
@@ -1351,12 +1340,10 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
intern->u.regex.flags = 0;
intern->u.regex.preg_flags = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Os|lll", &zobject, ce_inner, &regex, &regex_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;
@@ -1364,7 +1351,6 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
intern->u.regex.pce = pcre_get_compiled_regex_cache(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++;
@@ -1373,13 +1359,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);
@@ -1389,7 +1374,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 ee5fe5e8f5..85b5e193df 100755
--- a/ext/spl/spl_observer.c
+++ b/ext/spl/spl_observer.c
@@ -640,15 +640,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 8c183e4e48..69e7443271 100644
--- a/ext/sqlite/sqlite.c
+++ b/ext/sqlite/sqlite.c
@@ -1687,10 +1687,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, "s|lz/",
&filename, &filename_len, &mode, &errmsg)) {
- php_std_error_handling();
return;
}
if (errmsg) {
@@ -1701,7 +1700,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 {
@@ -1711,7 +1709,6 @@ PHP_FUNCTION(sqlite_open)
if ((PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) ||
php_check_open_basedir(fullpath TSRMLS_CC)) {
- php_std_error_handling();
efree(fullpath);
if (object) {
RETURN_NULL();
@@ -1726,7 +1723,6 @@ PHP_FUNCTION(sqlite_open)
if (fullpath) {
efree(fullpath);
}
- php_std_error_handling();
}
/* }}} */
@@ -1739,10 +1735,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, "s|lz/",
&filename, &filename_len, &mode, &errmsg)) {
- php_std_error_handling();
RETURN_NULL();
}
if (errmsg) {
@@ -1753,14 +1748,12 @@ 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 ((PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) ||
php_check_open_basedir(fullpath TSRMLS_CC)) {
efree(fullpath);
- php_std_error_handling();
RETURN_NULL();
}
}
@@ -1769,7 +1762,6 @@ PHP_FUNCTION(sqlite_factory)
if (fullpath) {
efree(fullpath);
}
- php_std_error_handling();
}
/* }}} */
@@ -2425,11 +2417,11 @@ PHP_FUNCTION(sqlite_fetch_object)
zend_fcall_info_cache fcc;
zval *retval_ptr;
zval *ctor_params = NULL;
+ 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, "|szb", &class_name, &class_name_len, &ctor_params, &decode_binary)) {
- php_std_error_handling();
return;
}
RES_FROM_OBJECT(res, object);
@@ -2440,7 +2432,6 @@ PHP_FUNCTION(sqlite_fetch_object)
}
} else {
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|szb", &zres, &class_name, &class_name_len, &ctor_params, &decode_binary)) {
- php_std_error_handling();
return;
}
ZEND_FETCH_RESOURCE(res, struct php_sqlite_result *, &zres, -1, "sqlite result", le_sqlite_result);
@@ -2453,21 +2444,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);