Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions ext/pdo/pdo_dbh.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion ext/pdo/php_pdo_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion ext/pdo/php_pdo_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 { \
Expand Down