[php-src] master: Merge branch 'PHP-8.6'

From: Date: Sun, 11 Oct 2026 12:32:22 +0000
Subject: [php-src] master: Merge branch 'PHP-8.6'
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-142184@lists.php.net to get a copy of this message
Author: Ilia Alshanetsky (iliaal) Date: 2026-10-11T08:22:56-04:00 Commit: https://github.com/php/php-src/commit/870fe777b0d2c5adcde1b86fc345ffa5115cfb26 Raw diff: https://github.com/php/php-src/commit/870fe777b0d2c5adcde1b86fc345ffa5115cfb26.diff Merge branch 'PHP-8.6' * PHP-8.6: ext/pdo: Avoid a duplicate warning for a rejected statement class Changed paths: A ext/pdo/tests/pdo_persistent_statement_class.phpt M ext/pdo/pdo_dbh.c Diff: diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index e443aa164e0a..2277df62a37b 100644 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -898,7 +898,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 (#142184) next »