Commit 830c9d0f9ee for php.net

commit 830c9d0f9eedc8396d0b301c38105fa7433572ee
Merge: 1e4b1d41d78 b782a27242b
Author: Ilia Alshanetsky <ilia@ilia.ws>
Date:   Tue Aug 18 19:33:27 2026 -0400

    Merge branch 'PHP-8.4' into PHP-8.5

    * PHP-8.4:
      Fix leak when persistent PDO liveness check fails

diff --cc NEWS
index 149cfc869e3,7216f5c5a7d..185c4799343
--- a/NEWS
+++ b/NEWS
@@@ -28,13 -26,17 +28,17 @@@ PH
  - Opcache:
    . Fixed opcache.protect_memory race under ZTS. (realFlowControl)

+ - PDO:
+   . Fixed a leak when a persistent connection failed a liveness check
+     with no other live PDO handle. (iliaal)
+
 -- Standard:
 -  . Fixed a memory leak in array_merge_recursive() when the recursive merge of
 -    an object converted to an array fails. (David Carlier)
 +- Readline:
 +  . Fixed the interactive shell not waiting for the pager process to exit.
 +    (Weilin Du)

  - Zip:
 -  . Fixed ZipArchive::extractTo() and ZipArchive::getFrom*() reporting success
 -    on corrupted entries. (David Carlier)
 +  . Fixed bug GH-17787 (ZipArchive stream stops reading early when the archive
 +    is freed while the stream is still open). (Eyüp Can Akman)

  - SAPI:
    . Fixed returns uninitialized value on LiteSpeed lsapi SAPI (Go Kudo)
diff --cc ext/pdo/pdo_dbh.c
index 08e398ea368,9f3d20745df..43c2cf8c094
--- a/ext/pdo/pdo_dbh.c
+++ b/ext/pdo/pdo_dbh.c
@@@ -418,9 -411,12 +418,12 @@@ PDO_API void php_pdo_internal_construct

  					/* is the connection still alive ? */
  					if (pdbh->methods->check_liveness && FAILURE == (pdbh->methods->check_liveness)(pdbh)) {
- 						/* nope... need to kill it */
- 						pdbh->refcount--;
- 						zend_list_close(le);
+ 						if (pdbh->refcount > 1) {
+ 							pdbh->refcount--;
+ 							zend_list_close(le);
+ 						} else {
 -							zend_hash_str_del(&EG(persistent_list), hashkey, plen);
++							zend_hash_del(&EG(persistent_list), hash_key);
+ 						}
  						pdbh = NULL;
  					}
  				}