Commit 26e5bc454c9 for php

commit 26e5bc454c9c507f714c3131cdb460eccad960ed
Author: Ilia Alshanetsky <ilia@ilia.ws>
Date:   Fri Sep 25 06:12:19 2026 -0400

    ext/pdo: Avoid a duplicate warning for a rejected statement class

    pdo_raise_impl_error() already reports the rejection of
    ATTR_STATEMENT_CLASS on a persistent connection, and the
    PDO_HANDLE_DBH_ERR() that followed emitted a second "General error"
    warning in ERRMODE_WARNING. Exception mode was unaffected,
    because the second call saw the pending exception.

    Closes GH-24204

diff --git a/NEWS b/NEWS
index 491e526d6b8..aaed43baa2c 100644
--- a/NEWS
+++ b/NEWS
@@ -37,6 +37,10 @@ PHP                                                                        NEWS
   . Fixed bug GH-24218 (Invalid opcode for count() of a literal array when
     SCCP is disabled). (Lazizbek Ergashev)

+- 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 d3fcf610124..a8be45e1558 100644
--- a/ext/pdo/pdo_dbh.c
+++ b/ext/pdo/pdo_dbh.c
@@ -900,7 +900,6 @@ static bool pdo_dbh_attribute_set(pdo_dbh_t *dbh, zend_long attr, zval *value) /
 				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 00000000000..0436fc9176f
--- /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