summaryrefslogtreecommitdiff
path: root/ext/sqlite/sqlite.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/sqlite/sqlite.c')
-rw-r--r--ext/sqlite/sqlite.c21
1 files changed, 5 insertions, 16 deletions
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);