[php-src] master: Merge branch 'PHP-8.5'
| From: | Saki Takamachi | Date: | Sat, 05 Sep 2026 01:22:24 +0000 |
| Subject: | [php-src] master: Merge branch 'PHP-8.5' | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-141072@lists.php.net to get a copy of this message | ||
Author: Saki Takamachi (SakiTakamachi)
Date: 2026-09-05T10:21:49+09:00
Commit: https://github.com/php/php-src/commit/d6828db81bb2e037ae7f543131d1afbf2d5fd851
Raw diff: https://github.com/php/php-src/commit/d6828db81bb2e037ae7f543131d1afbf2d5fd851.diff
Merge branch 'PHP-8.5'
* PHP-8.5:
Fixed the behavior when using FETCH_DEFAULT (#21864)
Changed paths:
M ext/pdo/pdo_stmt.c
Diff:
diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c
index a414dcb62dd0..d458bb94ec90 100644
--- a/ext/pdo/pdo_stmt.c
+++ b/ext/pdo/pdo_stmt.c
@@ -1624,7 +1624,7 @@ bool pdo_stmt_setup_fetch_mode(pdo_stmt_t *stmt, zend_long mode, uint32_t
mode_a
pdo_stmt_free_default_fetch_mode(stmt);
- stmt->default_fetch_type = PDO_FETCH_BOTH;
+ stmt->default_fetch_type = stmt->dbh->default_fetch_type;
flags = mode & PDO_FETCH_FLAGS;
@@ -1632,6 +1632,8 @@ bool pdo_stmt_setup_fetch_mode(pdo_stmt_t *stmt, zend_long mode, uint32_t
mode_a
return false;
}
+ bool use_default = (mode & ~PDO_FETCH_FLAGS) == PDO_FETCH_USE_DEFAULT;
+
switch (mode & ~PDO_FETCH_FLAGS) {
case PDO_FETCH_USE_DEFAULT:
case PDO_FETCH_LAZY:
@@ -1747,7 +1749,9 @@ bool pdo_stmt_setup_fetch_mode(pdo_stmt_t *stmt, zend_long mode, uint32_t
mode_a
return false;
}
- stmt->default_fetch_type = mode;
+ if (!use_default) {
+ stmt->default_fetch_type = mode;
+ }
return true;
}