Skip to content

Commit 824d1f9

Browse files
committed
Fix replaced error handling in SQLite3Stmt::__construct
The error handling is replaced using zend_replace_error_handling(), but when SQLITE3_CHECK_INITIALIZED() returns early, the old error handling isn't restored. In the past, SQLITE3_CHECK_INITIALIZED() threw a warning when the check failed. This was replaced a few years ago with an error exception. So we can fix the bug by just removing the replacing error handling as it accomplishes nothing anymore. Closes GH-11607.
1 parent 0aaad46 commit 824d1f9

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ PHP NEWS
4646
- Standard:
4747
. Fix serialization of RC1 objects appearing in object graph twice. (ilutov)
4848

49+
- SQLite3:
50+
. Fix replaced error handling in SQLite3Stmt::__construct. (nielsdos)
51+
4952
06 Jul 2023, PHP 8.1.21
5053

5154
- CLI:

ext/sqlite3/sqlite3.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1820,7 +1820,6 @@ PHP_METHOD(SQLite3Stmt, __construct)
18201820
zval *db_zval;
18211821
zend_string *sql;
18221822
int errcode;
1823-
zend_error_handling error_handling;
18241823
php_sqlite3_free_list *free_item;
18251824

18261825
stmt_obj = Z_SQLITE3_STMT_P(object);
@@ -1831,9 +1830,7 @@ PHP_METHOD(SQLite3Stmt, __construct)
18311830

18321831
db_obj = Z_SQLITE3_DB_P(db_zval);
18331832

1834-
zend_replace_error_handling(EH_THROW, NULL, &error_handling);
18351833
SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3)
1836-
zend_restore_error_handling(&error_handling);
18371834

18381835
if (!ZSTR_LEN(sql)) {
18391836
RETURN_FALSE;

0 commit comments

Comments
 (0)