From 92d0cdc41f072584bf642062fc2cedddd390627b Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Fri, 5 Jun 2026 16:50:23 +0200 Subject: [PATCH 1/2] ext/phar: stream context options are always stored in an array These cannot be objects and thus there is no need to use HASH_OF. Can be double checked looking at stream_context_set_option() and stream_context_set_options() functions --- ext/phar/stream.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ext/phar/stream.c b/ext/phar/stream.c index 3fee251d2589..76b956483065 100644 --- a/ext/phar/stream.c +++ b/ext/phar/stream.c @@ -213,8 +213,10 @@ static php_stream * phar_wrapper_open_url(php_stream_wrapper *wrapper, const cha php_url_free(resource); efree(internal_file); - if (context && Z_TYPE(context->options) != IS_UNDEF && (pzoption = zend_hash_str_find_ind(HASH_OF(&context->options), "phar", sizeof("phar")-1)) != NULL) { - pharcontext = HASH_OF(pzoption); + ZEND_ASSERT(Z_TYPE(context->options) == IS_UNDEF || Z_TYPE(context->options) == IS_ARRAY); + if (context && Z_TYPE(context->options) != IS_UNDEF && (pzoption = zend_hash_str_find(Z_ARR(context->options), "phar", sizeof("phar")-1)) != NULL) { + ZEND_ASSERT(Z_TYPE_P(pzoption) == IS_ARRAY); + pharcontext = Z_ARR_P(pzoption); if (idata->internal_file->uncompressed_filesize == 0 && idata->internal_file->compressed_filesize == 0 && (pzoption = zend_hash_str_find_ind(pharcontext, "compress", sizeof("compress")-1)) != NULL From b837a3261f6d5977dfe2a070b39c8aa8d2218160 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Sat, 6 Jun 2026 08:59:38 +0200 Subject: [PATCH 2/2] [skip ci] remove assertion --- ext/phar/stream.c | 1 - 1 file changed, 1 deletion(-) diff --git a/ext/phar/stream.c b/ext/phar/stream.c index 76b956483065..9474498e3892 100644 --- a/ext/phar/stream.c +++ b/ext/phar/stream.c @@ -213,7 +213,6 @@ static php_stream * phar_wrapper_open_url(php_stream_wrapper *wrapper, const cha php_url_free(resource); efree(internal_file); - ZEND_ASSERT(Z_TYPE(context->options) == IS_UNDEF || Z_TYPE(context->options) == IS_ARRAY); if (context && Z_TYPE(context->options) != IS_UNDEF && (pzoption = zend_hash_str_find(Z_ARR(context->options), "phar", sizeof("phar")-1)) != NULL) { ZEND_ASSERT(Z_TYPE_P(pzoption) == IS_ARRAY); pharcontext = Z_ARR_P(pzoption);