Skip to content

Commit c701c57

Browse files
authored
ext/phar: stream context options are always stored in an array (#22234)
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.
1 parent 95b5b48 commit c701c57

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

ext/phar/stream.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,9 @@ static php_stream * phar_wrapper_open_url(php_stream_wrapper *wrapper, const cha
213213
php_url_free(resource);
214214
efree(internal_file);
215215

216-
if (context && Z_TYPE(context->options) != IS_UNDEF && (pzoption = zend_hash_str_find_ind(HASH_OF(&context->options), "phar", sizeof("phar")-1)) != NULL) {
217-
pharcontext = HASH_OF(pzoption);
216+
if (context && Z_TYPE(context->options) != IS_UNDEF && (pzoption = zend_hash_str_find(Z_ARR(context->options), "phar", sizeof("phar")-1)) != NULL) {
217+
ZEND_ASSERT(Z_TYPE_P(pzoption) == IS_ARRAY);
218+
pharcontext = Z_ARR_P(pzoption);
218219
if (idata->internal_file->uncompressed_filesize == 0
219220
&& idata->internal_file->compressed_filesize == 0
220221
&& (pzoption = zend_hash_str_find_ind(pharcontext, "compress", sizeof("compress")-1)) != NULL

0 commit comments

Comments
 (0)