From: Pierre Joye Date: Tue, 9 May 2006 11:14:43 +0000 (+0000) Subject: - #7586 (pecl), filter is not reseted between element X-Git-Tag: BEFORE_NEW_OUTPUT_API~264 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1a0f27a7078765450102d6ece73c25f39d8082d2;p=php - #7586 (pecl), filter is not reseted between element --- diff --git a/ext/filter/filter.c b/ext/filter/filter.c index 824c642190..6e805f61d6 100644 --- a/ext/filter/filter.c +++ b/ext/filter/filter.c @@ -495,7 +495,7 @@ PHP_FUNCTION(input_get) zval *array_ptr = NULL, *array_ptr2 = NULL, *array_ptr3 = NULL; HashTable *hash_ptr; int found = 0; - int filter_flags = 0; + long filter_flags = 0; zval *options = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls|lzs", &arg, &var, &var_len, &filter, &flags, &charset, &charset_len) == FAILURE) { @@ -694,6 +694,14 @@ PHP_FUNCTION(input_get_args) if (Z_TYPE_PP(element) != IS_ARRAY) { convert_to_long(*element); filter = Z_LVAL_PP(element); + filter_flags = FILTER_FLAG_SCALAR; + + if ((filter_flags & FILTER_FLAG_SCALAR) && Z_TYPE_PP(tmp) == IS_ARRAY) { + /* asked for scalar and found an array do not test further */ + add_assoc_bool(return_value, key, 0); + continue; + } + } else { if (zend_hash_find(HASH_OF(*element), "filter", sizeof("filter"), (void **)&option) == SUCCESS) { convert_to_long(*option); @@ -722,7 +730,7 @@ PHP_FUNCTION(input_get_args) filter_flags = FILTER_FLAG_SCALAR; } - if (filter_flags & FILTER_FLAG_SCALAR && Z_TYPE_PP(tmp) == IS_ARRAY) { + if ((filter_flags & FILTER_FLAG_SCALAR) && Z_TYPE_PP(tmp) == IS_ARRAY) { /* asked for scalar and found an array do not test further */ add_assoc_bool(return_value, key, 0); continue; @@ -756,7 +764,8 @@ PHP_FUNCTION(input_get_args) } else { add_assoc_null(return_value, key); } - filter_flags = 0; + filter = FILTER_DEFAULT; + filter_flags = FILTER_FLAG_SCALAR; } } /* }}} */ diff --git a/ext/filter/tests/bug7586.phpt b/ext/filter/tests/bug7586.phpt new file mode 100644 index 0000000000..af4be33f78 --- /dev/null +++ b/ext/filter/tests/bug7586.phpt @@ -0,0 +1,53 @@ +--TEST-- +input_get_args() filter not reseted between elements +--FILE-- + 'libgd