Skip to content

Commit 3b387ef

Browse files
authored
ext/standard: stream_get_filters() user filters list as packed arrays. (#18384)
1 parent c15cacc commit 3b387ef

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ext/standard/user_filters.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,16 +476,19 @@ PHP_FUNCTION(stream_get_filters)
476476

477477
ZEND_PARSE_PARAMETERS_NONE();
478478

479-
array_init(return_value);
480479

481480
filters_hash = php_get_stream_filters_hash();
482481

483482
if (filters_hash && !HT_IS_PACKED(filters_hash)) {
483+
array_init(return_value);
484+
zend_hash_real_init_packed(Z_ARRVAL_P(return_value));
484485
ZEND_HASH_MAP_FOREACH_STR_KEY(filters_hash, filter_name) {
485486
if (filter_name) {
486487
add_next_index_str(return_value, zend_string_copy(filter_name));
487488
}
488489
} ZEND_HASH_FOREACH_END();
490+
} else {
491+
RETURN_EMPTY_ARRAY();
489492
}
490493
/* It's okay to return an empty array if no filters are registered */
491494
}

0 commit comments

Comments
 (0)