1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

ext/standard: stream_get_filters() user filters list as packed arrays. (#18384)

This commit is contained in:
David CARLIER
2025-04-21 17:03:35 +01:00
committed by GitHub
parent c15cacc902
commit 3b387ef274

View File

@@ -476,16 +476,19 @@ PHP_FUNCTION(stream_get_filters)
ZEND_PARSE_PARAMETERS_NONE();
array_init(return_value);
filters_hash = php_get_stream_filters_hash();
if (filters_hash && !HT_IS_PACKED(filters_hash)) {
array_init(return_value);
zend_hash_real_init_packed(Z_ARRVAL_P(return_value));
ZEND_HASH_MAP_FOREACH_STR_KEY(filters_hash, filter_name) {
if (filter_name) {
add_next_index_str(return_value, zend_string_copy(filter_name));
}
} ZEND_HASH_FOREACH_END();
} else {
RETURN_EMPTY_ARRAY();
}
/* It's okay to return an empty array if no filters are registered */
}