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

From: Date: Sun, 11 Oct 2026 12:32:15 +0000
Subject: [php-src] PHP-8.6: Merge branch 'PHP-8.5' into PHP-8.6
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-142181@lists.php.net to get a copy of this message
Author: Ilia Alshanetsky (iliaal) Date: 2026-10-11T08:22:55-04:00 Commit: https://github.com/php/php-src/commit/700c394e71e905e6fa91450a2320d0b47325173f Raw diff: https://github.com/php/php-src/commit/700c394e71e905e6fa91450a2320d0b47325173f.diff Merge branch 'PHP-8.5' into PHP-8.6 * PHP-8.5: ext/pdo: Avoid a duplicate warning for a rejected statement class Changed paths: A ext/pdo/tests/pdo_persistent_statement_class.phpt M NEWS M ext/pdo/pdo_dbh.c Diff: diff --git a/NEWS b/NEWS index 7abff44fbb10..4b109061430e 100644 --- a/NEWS +++ b/NEWS @@ -28,6 +28,10 @@ PHP NEWS . Fix OSS-Fuzz #568005340 (FETCH_DIM_FUNC_ARG partial conversion). (ndossche) . Fix exception checks due to NAN warnings and object empty()'s. (ndossche) +- PDO: + . Fixed a duplicate warning when ATTR_STATEMENT_CLASS is rejected on a + persistent connection. (Ilia Alshanetsky) + - Phpdbg: . Fix wrong command names. (ndossche, Weilin Du) diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index 6b0d22d09399..ee5b7c24401c 100644 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -899,7 +899,6 @@ static bool pdo_dbh_attribute_set(pdo_dbh_t *dbh, zend_long attr, zval *value, u pdo_raise_impl_error(dbh, NULL, "HY000", "PDO::ATTR_STATEMENT_CLASS cannot be used with persistent PDO instances" ); - PDO_HANDLE_DBH_ERR(); return false; } if (Z_TYPE_P(value) != IS_ARRAY) { diff --git a/ext/pdo/tests/pdo_persistent_statement_class.phpt b/ext/pdo/tests/pdo_persistent_statement_class.phpt new file mode 100644 index 000000000000..0436fc9176fa --- /dev/null +++ b/ext/pdo/tests/pdo_persistent_statement_class.phpt @@ -0,0 +1,32 @@ +--TEST-- +PDO Common: Rejecting ATTR_STATEMENT_CLASS on a persistent connection reports one error +--EXTENSIONS-- +pdo +--SKIPIF-- +<?php +$dir = getenv('REDIR_TEST_DIR'); +if (false == $dir) die('skip no driver'); +require_once $dir . 'pdo_test.inc'; +PDOTest::skip(); +?> +--FILE-- +<?php +if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../../pdo/tests/'); +require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; + +putenv("PDOTEST_ATTR=" . serialize([PDO::ATTR_PERSISTENT => true])); +$db = PDOTest::factory(); + +var_dump($db->setAttribute(PDO::ATTR_STATEMENT_CLASS, [PDOStatement::class])); + +$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); +try { + $db->setAttribute(PDO::ATTR_STATEMENT_CLASS, [PDOStatement::class]); +} catch (PDOException $e) { + echo $e::class, ": ", $e->getMessage(), "\n"; +} +?> +--EXPECTF-- +Warning: PDO::setAttribute(): SQLSTATE[HY000]: General error: PDO::ATTR_STATEMENT_CLASS cannot be used with persistent PDO instances in %s on line %d +bool(false) +PDOException: SQLSTATE[HY000]: General error: PDO::ATTR_STATEMENT_CLASS cannot be used with persistent PDO instances

« previous php.cvs (#142181) next »