[php-src] master: pdo: refactor pdo_stmt_construct() to use zend_object* rather than zval* (#24019)

From: Date: Wed, 30 Sep 2026 16:04:57 +0000
Subject: [php-src] master: pdo: refactor pdo_stmt_construct() to use zend_object* rather than zval* (#24019)
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-141803@lists.php.net to get a copy of this message
Author: Gina Peter Banyard (Girgias) Committer: GitHub (web-flow) Pusher: Girgias Date: 2026-09-30T17:04:53+01:00 Commit: https://github.com/php/php-src/commit/66e9ef275ede1205e0d0928e02228dbacdb01c44 Raw diff: https://github.com/php/php-src/commit/66e9ef275ede1205e0d0928e02228dbacdb01c44.diff pdo: refactor pdo_stmt_construct() to use zend_object* rather than zval* (#24019) And add const qualifiers Changed paths: M ext/pdo/pdo_dbh.c Diff: diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index 6b0d22d09399..7a77fdae31f7 100644 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -564,18 +564,18 @@ static zval *pdo_stmt_instantiate(pdo_dbh_t *dbh, zval *object, zend_class_entry return object; } /* }}} */ -static void pdo_stmt_construct(pdo_stmt_t *stmt, zval *object, zend_class_entry *dbstmt_ce, HashTable *ctor_args) +static void pdo_stmt_construct(const pdo_stmt_t *stmt, zend_object *object, const zend_class_entry *dbstmt_ce, HashTable *ctor_args) { zval query_string; zend_string *key; ZVAL_STR(&query_string, stmt->query_string); key = ZSTR_INIT_LITERAL("queryString", 0); - zend_std_write_property(Z_OBJ_P(object), key, &query_string, NULL); + zend_std_write_property(object, key, &query_string, NULL); zend_string_release_ex(key, 0); if (dbstmt_ce->constructor) { - zend_call_known_function(dbstmt_ce->constructor, Z_OBJ_P(object), Z_OBJCE_P(object), NULL, 0, NULL, ctor_args); + zend_call_known_function(dbstmt_ce->constructor, object, object->ce, NULL, 0, NULL, ctor_args); } } @@ -658,9 +658,9 @@ PHP_METHOD(PDO, prepare) if (dbh->methods->preparer(dbh, statement, stmt, options)) { if (Z_TYPE(ctor_args) == IS_ARRAY) { - pdo_stmt_construct(stmt, return_value, dbstmt_ce, Z_ARRVAL(ctor_args)); + pdo_stmt_construct(stmt, Z_OBJ_P(return_value), dbstmt_ce, Z_ARRVAL(ctor_args)); } else { - pdo_stmt_construct(stmt, return_value, dbstmt_ce, /* ctor_args */ NULL); + pdo_stmt_construct(stmt, Z_OBJ_P(return_value), dbstmt_ce, /* ctor_args */ NULL); } return; } @@ -1236,9 +1236,9 @@ PHP_METHOD(PDO, query) } if (ret) { if (Z_TYPE(dbh->def_stmt_ctor_args) == IS_ARRAY) { - pdo_stmt_construct(stmt, return_value, dbh->def_stmt_ce, Z_ARRVAL(dbh->def_stmt_ctor_args)); + pdo_stmt_construct(stmt, Z_OBJ_P(return_value), dbh->def_stmt_ce, Z_ARRVAL(dbh->def_stmt_ctor_args)); } else { - pdo_stmt_construct(stmt, return_value, dbh->def_stmt_ce, /* ctor_args */ NULL); + pdo_stmt_construct(stmt, Z_OBJ_P(return_value), dbh->def_stmt_ce, /* ctor_args */ NULL); } return; }

« previous php.cvs (#141803) next »