[php-src] master: Merge branch 'PHP-8.4' into PHP-8.5

From: Date: Sun, 18 Oct 2026 19:41:43 +0000
Subject: [php-src] master: Merge branch 'PHP-8.4' into PHP-8.5
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-142425@lists.php.net to get a copy of this message
Author: Ilia Alshanetsky (iliaal) Date: 2026-10-18T15:41:08-04:00 Commit: https://github.com/php/php-src/commit/dbeb8a77fbf1d526b78003e0364fc15da1c93231 Raw diff: https://github.com/php/php-src/commit/dbeb8a77fbf1d526b78003e0364fc15da1c93231.diff Merge branch 'PHP-8.4' into PHP-8.5 * PHP-8.4: Fix GH-24372: Keep stmt->executed set across PDOStatement::execute() Changed paths: M ext/pdo/pdo_stmt.c M ext/pdo/php_pdo_driver.h Diff: diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index a343117cbc0c..a27c491b5cd3 100644 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -387,29 +387,6 @@ static bool really_register_bound_param(struct pdo_bound_param_data *param, pdo_ } /* }}} */ -static bool pdo_stmt_do_next_rowset(pdo_stmt_t *stmt); - -static void pdo_stmt_invalidate_result(pdo_stmt_t *stmt) -{ - if (stmt->methods->cursor_closer) { - stmt->methods->cursor_closer(stmt); - } else { - do { - while (stmt->methods->fetcher(stmt, PDO_FETCH_ORI_NEXT, 0)) - ; - if (!stmt->methods->next_rowset) { - break; - } - - if (!pdo_stmt_do_next_rowset(stmt)) { - break; - } - } while (1); - } - - stmt->executed = 0; -} - /* {{{ Execute a prepared statement, optionally binding parameters */ PHP_METHOD(PDOStatement, execute) { @@ -426,9 +403,10 @@ PHP_METHOD(PDOStatement, execute) RETURN_THROWS(); } - if (stmt->executed) { - pdo_stmt_invalidate_result(stmt); + if (stmt->executed && stmt->methods->cursor_closer) { + stmt->methods->cursor_closer(stmt); } + stmt->execute_incomplete = 1; PDO_STMT_CLEAR_ERR(); if (input_params) { @@ -495,6 +473,7 @@ PHP_METHOD(PDOStatement, execute) RETURN_FALSE; } if (stmt->methods->executer(stmt)) { + stmt->execute_incomplete = 0; if (!stmt->executed) { /* this is the first execute */ @@ -601,7 +580,7 @@ static inline void fetch_value(pdo_stmt_t *stmt, zval *dest, int colno, enum pdo static bool do_fetch_common(pdo_stmt_t *stmt, enum pdo_fetch_orientation ori, zend_long offset) /* {{{ */ { - if (!stmt->executed) { + if (!stmt->executed || stmt->execute_incomplete) { return 0; } diff --git a/ext/pdo/php_pdo_driver.h b/ext/pdo/php_pdo_driver.h index 6b09e861fed7..bac69fad2f87 100644 --- a/ext/pdo/php_pdo_driver.h +++ b/ext/pdo/php_pdo_driver.h @@ -578,7 +578,8 @@ struct _pdo_stmt_t { * emulate prepare and bind on its behalf */ uint16_t supports_placeholders:2; uint16_t in_param_event:1; - uint16_t reserved: 11; + uint16_t execute_incomplete:1; + uint16_t reserved: 10; /* keep track of bound input parameters. Some drivers support * input/output parameters, but you can't rely on that working */

« previous php.cvs (#142425) next »