Commit d2f92b31396 for php.net
commit d2f92b3139631f985713d77e1fd361938ac5684e
Merge: a634462e0ae eaac0378e3c
Author: ndossche <7771979+ndossche@users.noreply.github.com>
Date: Mon Aug 3 22:55:51 2026 +0200
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
sqlite3: Fix leak when trying to close db if blob stream is still open
diff --cc NEWS
index 20286543c03,6738d104f5b..f1b69e3e8ca
--- a/NEWS
+++ b/NEWS
@@@ -39,10 -31,11 +39,13 @@@ PH
(DanielEScherzer)
- Sockets:
+ . Fixed socket_set_option() validation error messages for UDP_SEGMENT and
+ SO_LINGER options. (Weilin Du)
. Fixed various memory related issues in ext/sockets. (David Carlier)
+ - SQLite:
+ . Fix leak when trying to close db if blob stream is still open. (ndossche)
+
- Streams:
. Fixed bug GH-15836 (Use-after-free when a user stream filter accesses
$this->stream during the close flush). (iliaal)
diff --cc ext/sqlite3/sqlite3.c
index a9e2a3a6c30,20714c38aad..c9a30cb52e0
--- a/ext/sqlite3/sqlite3.c
+++ b/ext/sqlite3/sqlite3.c
@@@ -2338,8 -2255,10 +2338,10 @@@ static void php_sqlite3_object_free_sto
}
if (intern->initialised && intern->db) {
- sqlite3_close(intern->db);
+ /* Use sqlite3_close_v2() because the object may be destroyed while resources depending on the connection are still alive,
+ * e.g. a blob stream created by SQLite3::openBlob(). */
+ sqlite3_close_v2(intern->db);
- intern->initialised = 0;
+ intern->initialised = false;
}
zend_object_std_dtor(&intern->zo);