Commit 786356db160 for php.net
commit 786356db16090b2a8733369982183c5d786e347c
Merge: 3bb8072bd78 3df1fa7a431
Author: Gina Peter Banyard <girgias@php.net>
Date: Mon Apr 20 17:01:05 2026 +0100
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
Update NEWS for recent bug fixes
ext/phar: Fix memory leak in phar_verify_signature() when md_ctx is invalid
phar: propagate phar_stream_flush return value from phar_stream_close
phar: call phar_entry_delref before goto finish in phar_add_file error paths
phar: free is_temp_dir entry before rejecting .phar/* paths in offsetGet
phar: fix NULL dereference in Phar::webPhar() when SCRIPT_NAME is absent
phar: restore is_link handler in phar_intercept_functions_shutdown
diff --cc NEWS
index 9472d517d90,881a1765b88..b70e82061ad
--- a/NEWS
+++ b/NEWS
@@@ -42,13 -39,19 +42,24 @@@ PH
. Fixed faulty returns out of zend_try block in zend_jit_trace(). (ilutov)
- OpenSSL:
+ . Fix memory leak regression in openssl_pbkdf2(). (ndossche)
. Fix a bunch of memory leaks and crashes on edge cases. (ndossche)
+- PDO_PGSQL:
+ . Fixed bug GH-21683 (pdo_pgsql throws with ATTR_PREFETCH=0
+ on empty result set). (thomasschiet)
+
+ - Phar:
+ . Restore is_link handler in phar_intercept_functions_shutdown. (iliaal)
+ . Fixed bug GH-21797 (phar: NULL dereference in Phar::webPhar() when
+ SCRIPT_NAME is absent from SAPI environment). (iliaal)
+ . Fix memory leak in Phar::offsetGet(). (iliaal)
+ . Fix memory leak in phar_add_file(). (iliaal)
+ . Fixed bug GH-21799 (phar: propagate phar_stream_flush return value from
+ phar_stream_close). (iliaal)
+ . Fix memory leak in phar_verify_signature() when md_ctx is invalid.
+ (JarneClauw)
+
- Random:
. Fixed bug GH-21731 (Random\Engine\Xoshiro256StarStar::__unserialize()
accepts all-zero state). (iliaal)
diff --cc ext/phar/phar_object.c
index 20e1e69ca57,bb96c783e93..cc94539bd24
--- a/ext/phar/phar_object.c
+++ b/ext/phar/phar_object.c
@@@ -3590,6 -3594,11 +3593,11 @@@ PHP_METHOD(Phar, offsetGet
if (!(entry = phar_get_entry_info_dir(phar_obj->archive, ZSTR_VAL(file_name), ZSTR_LEN(file_name), 1, &error, 0))) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Entry %s does not exist%s%s", ZSTR_VAL(file_name), error?", ":"", error?error:"");
} else {
+ if (entry->is_temp_dir) {
- efree(entry->filename);
++ zend_string_efree(entry->filename);
+ efree(entry);
+ }
+
if (zend_string_equals_literal(file_name, ".phar/stub.php")) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Cannot get stub \".phar/stub.php\" directly in phar \"%s\", use getStub", phar_obj->archive->fname);
RETURN_THROWS();