diff --git a/ext/filter/filter.c b/ext/filter/filter.c index b787ef706c4f..ee8db5ef3583 100644 --- a/ext/filter/filter.c +++ b/ext/filter/filter.c @@ -690,29 +690,13 @@ PHP_FUNCTION(filter_input_array) } array_input = php_filter_get_storage(fetch_from); + if (EG(exception)) { RETURN_THROWS(); } if (!array_input) { - zend_long filter_flags = 0; - zval *option; - if (op_long) { - filter_flags = op_long; - } else if (op_ht && (option = zend_hash_str_find(op_ht, "flags", sizeof("flags") - 1)) != NULL) { - filter_flags = zval_get_long(option); - } - - /* The FILTER_NULL_ON_FAILURE flag inverts the usual return values of - * the function: normally when validation fails false is returned, and - * when the input value doesn't exist NULL is returned. With the flag - * set, NULL and false should be returned, respectively. Ergo, although - * the code below looks incorrect, it's actually right. */ - if (filter_flags & FILTER_NULL_ON_FAILURE) { - RETURN_FALSE; - } else { - RETURN_NULL(); - } + RETURN_NULL(); } php_filter_array_handler(array_input, op_ht, op_long, return_value, add_empty); diff --git a/ext/filter/tests/filter_input_array_001.phpt b/ext/filter/tests/filter_input_array_001.phpt new file mode 100644 index 000000000000..038ebc6dd2cd --- /dev/null +++ b/ext/filter/tests/filter_input_array_001.phpt @@ -0,0 +1,16 @@ +--TEST-- +filter_input_array: test FILTER_NULL_ON_FAILURE option does not affect general result on empty input +--EXTENSIONS-- +filter +--FILE-- + [ + "flags" => FILTER_NULL_ON_FAILURE, + ] +]; + +var_dump(filter_input_array(INPUT_GET, $args, true)); +?> +--EXPECT-- +NULL