mirror of
https://github.com/php/php-src.git
synced 2026-03-28 02:02:32 +01:00
Expose stream_filters_hash so that it can be searched by stream_get_filters()
This commit is contained in:
@@ -417,6 +417,7 @@ PHP_FUNCTION(stream_get_filters)
|
||||
{
|
||||
char *filter_name;
|
||||
int key_flags, filter_name_len = 0;
|
||||
HashTable *filters_hash;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 0) {
|
||||
WRONG_PARAM_COUNT;
|
||||
@@ -424,10 +425,12 @@ PHP_FUNCTION(stream_get_filters)
|
||||
|
||||
array_init(return_value);
|
||||
|
||||
if (BG(user_filter_map)) {
|
||||
for(zend_hash_internal_pointer_reset(BG(user_filter_map));
|
||||
(key_flags = zend_hash_get_current_key_ex(BG(user_filter_map), &filter_name, &filter_name_len, NULL, 0, NULL)) != HASH_KEY_NON_EXISTANT;
|
||||
zend_hash_move_forward(BG(user_filter_map)))
|
||||
filters_hash = php_get_stream_filters_hash();
|
||||
|
||||
if (filters_hash) {
|
||||
for(zend_hash_internal_pointer_reset(filters_hash);
|
||||
(key_flags = zend_hash_get_current_key_ex(filters_hash, &filter_name, &filter_name_len, NULL, 0, NULL)) != HASH_KEY_NON_EXISTANT;
|
||||
zend_hash_move_forward(filters_hash))
|
||||
if (key_flags == HASH_KEY_IS_STRING)
|
||||
add_next_index_stringl(return_value, filter_name, filter_name_len, 1);
|
||||
}
|
||||
|
||||
@@ -603,9 +603,9 @@ PHPAPI php_stream_context *php_stream_context_set(php_stream *stream, php_stream
|
||||
(xmsg), (xcode), 0, 0, NULL TSRMLS_CC); } } while(0)
|
||||
|
||||
|
||||
/* Give other modules access to the url_stream_wrappers_hash */
|
||||
/* Give other modules access to the url_stream_wrappers_hash and stream_filters_hash */
|
||||
PHPAPI HashTable *php_stream_get_url_stream_wrappers_hash();
|
||||
|
||||
PHPAPI HashTable *php_get_stream_filters_hash();
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
@@ -387,6 +387,11 @@ fprintf(stderr, "stream_free: %s:%p[%s] preserve_handle=%d release_cast=%d remov
|
||||
/* {{{ filter API */
|
||||
static HashTable stream_filters_hash;
|
||||
|
||||
PHPAPI HashTable *php_get_stream_filters_hash()
|
||||
{
|
||||
return &stream_filters_hash;
|
||||
}
|
||||
|
||||
PHPAPI int php_stream_filter_register_factory(const char *filterpattern, php_stream_filter_factory *factory TSRMLS_DC)
|
||||
{
|
||||
return zend_hash_add(&stream_filters_hash, (char*)filterpattern, strlen(filterpattern), factory, sizeof(*factory), NULL);
|
||||
|
||||
Reference in New Issue
Block a user