From 3c76ad1e67a70031f08782fccf070a40b42deb2c Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Tue, 21 Apr 2026 14:11:17 +0100 Subject: [PATCH 1/2] ext/phar: always free phar_archive_data->alias field if present This field is only ever assigned a newly allocated char* or NULL, as such it can never be equal to the phar_archive_data->fname field --- ext/phar/phar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/phar/phar.c b/ext/phar/phar.c index 5829d32e615e..4855517dd627 100644 --- a/ext/phar/phar.c +++ b/ext/phar/phar.c @@ -192,7 +192,7 @@ PHP_INI_END() */ void phar_destroy_phar_data(phar_archive_data *phar) /* {{{ */ { - if (phar->alias && phar->alias != phar->fname) { + if (phar->alias) { pefree(phar->alias, phar->is_persistent); phar->alias = NULL; } From 67a3656a1bad40e7c3fe468c1583793916dc0ce8 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Tue, 21 Apr 2026 16:11:21 +0100 Subject: [PATCH 2/2] also remove check in Phar::getAlias() --- ext/phar/phar_object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index 377f35832910..2e309d9a9831 100644 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -2631,7 +2631,7 @@ PHP_METHOD(Phar, getAlias) PHAR_ARCHIVE_OBJECT(); - if (phar_obj->archive->alias && phar_obj->archive->alias != phar_obj->archive->fname) { + if (phar_obj->archive->alias) { RETURN_STRINGL(phar_obj->archive->alias, phar_obj->archive->alias_len); } }