[php-src] master: Merge branch 'PHP-8.6'
| From: | Kamil Tekiela | Date: | Tue, 24 Nov 2026 17:26:08 +0000 |
| Subject: | [php-src] master: Merge branch 'PHP-8.6' | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-144122@lists.php.net to get a copy of this message | ||
Author: Kamil Tekiela (kamil-tekiela)
Date: 2026-11-24T17:25:36Z
Commit: https://github.com/php/php-src/commit/a49c65ad6e7850ed6d08a8ee5d2ae3e0425c4b1c
Raw diff: https://github.com/php/php-src/commit/a49c65ad6e7850ed6d08a8ee5d2ae3e0425c4b1c.diff
Merge branch 'PHP-8.6'
Changed paths:
M NEWS
M ext/pdo/pdo_stmt.c
M ext/pdo/tests/pdo_stmt_class_ctor_errors.phpt
Diff:
diff --git a/NEWS b/NEWS
index eaeb9894e2b2..c31c4fd02e95 100644
--- a/NEWS
+++ b/NEWS
@@ -115,6 +115,8 @@ PHP NEWS
transaction still in use by another instance). (Lazizbek Ergashev)
. Fixed PDOStatement::execute() leaving a partial set of bindings in place
when binding its array argument fails. (Ilia Alshanetsky, Kamil Tekiela)
+ . Fixed bug GH-25650 (PDO::query() reports the wrong argument numbers for
+ FETCH_CLASS constructor arguments). (Tomasz Kowalczyk)
- PDO_PGSQL:
. Improved performance of the SQL parser that handles placeholders.
diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c
index 97e7766a2395..bfdba4ed056f 100644
--- a/ext/pdo/pdo_stmt.c
+++ b/ext/pdo/pdo_stmt.c
@@ -1736,7 +1736,7 @@ bool pdo_stmt_setup_fetch_mode(pdo_stmt_t *stmt, zend_long mode, uint32_t
mode_a
}
if (Z_TYPE(args[1]) == IS_ARRAY && zend_hash_num_elements(Z_ARRVAL(args[1]))) {
if (cep->constructor == NULL) {
- zend_argument_value_error(3, "must be empty when class provided in argument #2 ($class)
does not have a constructor");
+ zend_argument_value_error(constructor_arg_num, "must be empty when class provided in
argument #%d ($class) does not have a constructor", arg1_arg_num);
return false;
}
fetch_ctor_args = Z_ARRVAL(args[1]);
diff --git a/ext/pdo/tests/pdo_stmt_class_ctor_errors.phpt
b/ext/pdo/tests/pdo_stmt_class_ctor_errors.phpt
index 85fdbbec37f2..a904e718448e 100644
--- a/ext/pdo/tests/pdo_stmt_class_ctor_errors.phpt
+++ b/ext/pdo/tests/pdo_stmt_class_ctor_errors.phpt
@@ -38,6 +38,11 @@ try {
} catch (\Throwable $e) {
echo $e::class, ': ', $e->getMessage(), \PHP_EOL;
}
+try {
+ var_dump($db->query('SELECT id, val, val2 from pdo_fetch_all_class_ctor_error',
PDO::FETCH_CLASS, 'TestBase', [0]));
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), \PHP_EOL;
+}
?>
--CLEAN--
@@ -49,3 +54,4 @@ PDOTest::dropTableIfExists($db, "pdo_fetch_all_class_ctor_error");
--EXPECT--
ValueError: PDOStatement::fetchAll(): Argument #3 must be empty when class provided in argument #2
($class) does not have a constructor
ValueError: PDOStatement::setFetchMode(): Argument #3 must be empty when class provided in argument
#2 ($class) does not have a constructor
+ValueError: PDO::query(): Argument #4 must be empty when class provided in argument #3 ($class)
does not have a constructor