[php-src] master: Merge branch 'PHP-8.6'
| From: | David Carlier | Date: | Sat, 26 Sep 2026 18:40:20 +0000 |
| Subject: | [php-src] master: Merge branch 'PHP-8.6' | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-141587@lists.php.net to get a copy of this message | ||
Author: David Carlier (devnexen)
Date: 2026-09-26T19:39:59+01:00
Commit: https://github.com/php/php-src/commit/cc9282ac84d67d34221d899a7060aca1febe6725
Raw diff: https://github.com/php/php-src/commit/cc9282ac84d67d34221d899a7060aca1febe6725.diff
Merge branch 'PHP-8.6'
* PHP-8.6:
ext/pdo_pgsql: Fix crash when a persistent connection fails
Changed paths:
A ext/pdo_pgsql/tests/persistent_connection_failure.phpt
M ext/pdo/pdo_dbh.c
Diff:
diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c
index 358ac81eb88f..5aa95cdccaf0 100644
--- a/ext/pdo/pdo_dbh.c
+++ b/ext/pdo/pdo_dbh.c
@@ -1597,7 +1597,7 @@ static void pdo_dbh_free_storage(zend_object *std)
dbh->in_txn = false;
}
- if (dbh->is_persistent && dbh->methods &&
dbh->methods->persistent_shutdown) {
+ if (dbh->is_persistent && dbh->driver_data && dbh->methods &&
dbh->methods->persistent_shutdown) {
dbh->methods->persistent_shutdown(dbh);
}
zend_object_std_dtor(std);
diff --git a/ext/pdo_pgsql/tests/persistent_connection_failure.phpt
b/ext/pdo_pgsql/tests/persistent_connection_failure.phpt
new file mode 100644
index 000000000000..7be690ae05a8
--- /dev/null
+++ b/ext/pdo_pgsql/tests/persistent_connection_failure.phpt
@@ -0,0 +1,21 @@
+--TEST--
+PDO PgSQL failed persistent connection does not crash on object destruction
+--EXTENSIONS--
+pdo_pgsql
+--FILE--
+<?php
+
+try {
+ new Pdo\Pgsql('pgsql:host=/nonexistent', options: [
+ PDO::ATTR_PERSISTENT => true,
+ ]);
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+}
+
+echo "Failed connection object destroyed without crash\n";
+
+?>
+--EXPECTF--
+PDOException: SQLSTATE[08006] [7] %a
+Failed connection object destroyed without crash