From 1dc5bd47d8707ba805927681bc878087d6b9b5fa Mon Sep 17 00:00:00 2001 From: Jeff Welch Date: Sun, 8 Mar 2015 11:31:26 -0400 Subject: [PATCH] Adjust logic in sanity checks. The code should return false when the provided options argument is neither an array nor a valid filter. --- ext/filter/filter.c | 4 ++-- ext/filter/tests/057.phpt | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 ext/filter/tests/057.phpt diff --git a/ext/filter/filter.c b/ext/filter/filter.c index 107ba86374..475cfccb2e 100644 --- a/ext/filter/filter.c +++ b/ext/filter/filter.c @@ -800,7 +800,7 @@ PHP_FUNCTION(filter_input_array) return; } - if (op && (Z_TYPE_P(op) != IS_ARRAY) && (Z_TYPE_P(op) == IS_LONG && !PHP_FILTER_ID_EXISTS(Z_LVAL_P(op)))) { + if (op && (Z_TYPE_P(op) != IS_ARRAY) && !(Z_TYPE_P(op) == IS_LONG && PHP_FILTER_ID_EXISTS(Z_LVAL_P(op)))) { RETURN_FALSE; } @@ -845,7 +845,7 @@ PHP_FUNCTION(filter_var_array) return; } - if (op && (Z_TYPE_P(op) != IS_ARRAY) && (Z_TYPE_P(op) == IS_LONG && !PHP_FILTER_ID_EXISTS(Z_LVAL_P(op)))) { + if (op && (Z_TYPE_P(op) != IS_ARRAY) && !(Z_TYPE_P(op) == IS_LONG && PHP_FILTER_ID_EXISTS(Z_LVAL_P(op)))) { RETURN_FALSE; } diff --git a/ext/filter/tests/057.phpt b/ext/filter/tests/057.phpt new file mode 100644 index 0000000000..93ab3eed36 --- /dev/null +++ b/ext/filter/tests/057.phpt @@ -0,0 +1,23 @@ +--TEST-- +filter_input_array() and filter_var_array() with invalid $definition arguments +--SKIPIF-- + +--FILE-- +