Skip to content

Commit a7df6a7

Browse files
committed
Merge branch 'PHP-8.4'
* PHP-8.4: Fix crash in PDO_ODBC statement dtor (#17586)
2 parents b14469b + 25bdbf9 commit a7df6a7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ext/pdo_odbc/odbc_stmt.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,11 @@ static int odbc_stmt_dtor(pdo_stmt_t *stmt)
136136
{
137137
pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data;
138138

139-
if (S->stmt != SQL_NULL_HANDLE) {
139+
// TODO: Factor this out; pg/mysql/firebird do the same thing
140+
bool server_obj_usable = !Z_ISUNDEF(stmt->database_object_handle)
141+
&& IS_OBJ_VALID(EG(objects_store).object_buckets[Z_OBJ_HANDLE(stmt->database_object_handle)])
142+
&& !(OBJ_FLAGS(Z_OBJ(stmt->database_object_handle)) & IS_OBJ_FREE_CALLED);
143+
if (S->stmt != SQL_NULL_HANDLE && server_obj_usable) {
140144
if (stmt->executed) {
141145
SQLCloseCursor(S->stmt);
142146
}

0 commit comments

Comments
 (0)