diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index 677e76f6caf74..8ec67c7b86105 100644 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -1248,7 +1248,7 @@ PHP_METHOD(PDO, query) } /* something broke */ dbh->query_stmt = stmt; - ZVAL_OBJ(&dbh->query_stmt_zval, Z_OBJ_P(return_value)); + dbh->query_stmt_obj = Z_OBJ_P(return_value); GC_DELREF(stmt->database_object_handle); stmt->database_object_handle = NULL; PDO_HANDLE_STMT_ERR(); @@ -1468,7 +1468,8 @@ static void dbh_free(pdo_dbh_t *dbh, bool free_persistent) int i; if (dbh->query_stmt) { - zval_ptr_dtor(&dbh->query_stmt_zval); + OBJ_RELEASE(dbh->query_stmt_obj); + dbh->query_stmt_obj = NULL; dbh->query_stmt = NULL; } diff --git a/ext/pdo/php_pdo_driver.h b/ext/pdo/php_pdo_driver.h index f232241b51248..98bcacee690e2 100644 --- a/ext/pdo/php_pdo_driver.h +++ b/ext/pdo/php_pdo_driver.h @@ -499,7 +499,7 @@ struct _pdo_dbh_t { * This will allow us to report the correct error message * when PDO::query() fails */ pdo_stmt_t *query_stmt; - zval query_stmt_zval; + zend_object *query_stmt_obj; /* defaults for fetches */ enum pdo_fetch_type default_fetch_type; diff --git a/ext/pdo/php_pdo_error.h b/ext/pdo/php_pdo_error.h index 41759b2d5ccc1..50c751a0f490f 100644 --- a/ext/pdo/php_pdo_error.h +++ b/ext/pdo/php_pdo_error.h @@ -26,7 +26,8 @@ PDO_API void pdo_handle_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt); memcpy(dbh->error_code, PDO_ERR_NONE, sizeof(PDO_ERR_NONE)); \ if (dbh->query_stmt) { \ dbh->query_stmt = NULL; \ - zval_ptr_dtor(&dbh->query_stmt_zval); \ + OBJ_RELEASE(dbh->query_stmt_obj); \ + dbh->query_stmt_obj = NULL; \ } \ } while (0) #define PDO_STMT_CLEAR_ERR() do { \