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);
}
/* }}} */
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);
ZVAL_NULL(getThis());
}
}
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
}
/* }}} */
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);
ZVAL_NULL(getThis());
}
}
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
}
/* }}} */
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) {
dpobj->recurrences = recurrences + dpobj->include_start_date;
dpobj->initialized = 1;
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
}
/* }}} */
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);
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);
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);
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);
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) {
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) {
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) {
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) {
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);
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);
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;
}
/* }}} */
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) {
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;
}
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);
}
}
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;
}
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);
}
/* }}} */
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;
}
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);
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;
} /* }}} */
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:
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;
}
}
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;
}
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;
}
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;
} /* }}} */
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;
}
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;
}
}
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);
}
/* }}} */
/* {{{ 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.
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;
}
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);
}
/* }}} */
{ \
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);\
}
/* }}} */
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));
RETVAL_STRING(buff, 1);
}
}
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
}
/* }}} */
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);
if (intern->file_name_type == IS_UNICODE && filename) {
efree(filename);
}
-
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
}
/* }}} */
#endif
{
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);
}
/* }}} */
{
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);
}
/* }}} */
{
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);
}
/* }}} */
{
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;
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);
}
/* }}} */
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;
&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;
}
intern->_path_type = IS_STRING;
}
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
} /* }}} */
/* {{{ proto void SplTempFileObject::__construct([int max_memory]) U
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;
}
intern->_path_len = 0;
intern->_path.s = estrndup("", 0);
}
-
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
} /* }}} */
/* {{{ proto void SplFileObject::rewind() U
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: {
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;
}
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
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);
} 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)
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) {
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;
}
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;
}
/* 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);
|| !(*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;
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;
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:
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;
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++;
#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);
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;
}
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;
}
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) {
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 {
}
if (php_check_open_basedir(fullpath TSRMLS_CC)) {
- php_std_error_handling();
efree(fullpath);
if (object) {
RETURN_NULL();
if (fullpath) {
efree(fullpath);
}
- php_std_error_handling();
}
/* }}} */
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) {
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();
}
}
if (fullpath) {
efree(fullpath);
}
- php_std_error_handling();
}
/* }}} */
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);
}
} 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);
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);