summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-07-07 08:57:05 +0200
committerNikita Popov <nikita.ppv@gmail.com>2020-07-07 08:57:05 +0200
commitb406b3d6247db5b46154dac86d026a1da7a697aa (patch)
treec79650f3544029625b5388ffa6a7b0a93a27c373 /ext
parent829a1e653a1df244fe301b61c788b8bb643570e1 (diff)
downloadphp-git-b406b3d6247db5b46154dac86d026a1da7a697aa.tar.gz
Don't allow separation in callback filter
This causes some tests to fail. Those tests are specifically about the callback not being able to modify the data though, so this is clearly not supposed to be a supported use-case.
Diffstat (limited to 'ext')
-rw-r--r--ext/filter/callback_filter.c2
-rw-r--r--ext/filter/tests/029.phpt31
2 files changed, 9 insertions, 24 deletions
diff --git a/ext/filter/callback_filter.c b/ext/filter/callback_filter.c
index d02a30b754..edba63e562 100644
--- a/ext/filter/callback_filter.c
+++ b/ext/filter/callback_filter.c
@@ -30,7 +30,7 @@ void php_filter_callback(PHP_INPUT_FILTER_PARAM_DECL)
}
ZVAL_COPY(&args[0], value);
- status = call_user_function_ex(NULL, NULL, option_array, &retval, 1, args, 0, NULL);
+ status = call_user_function(NULL, NULL, option_array, &retval, 1, args);
if (status == SUCCESS && !Z_ISUNDEF(retval)) {
zval_ptr_dtor(value);
diff --git a/ext/filter/tests/029.phpt b/ext/filter/tests/029.phpt
index 2c5d64cbb2..fc191f1710 100644
--- a/ext/filter/tests/029.phpt
+++ b/ext/filter/tests/029.phpt
@@ -45,30 +45,13 @@ var_dump(filter_var("data", FILTER_CALLBACK, array("options"=>"test2")));
var_dump(filter_var("~!@#$%^&*()_QWERTYUIOPASDFGHJKLZXCVBNM<>>?\"}{:", FILTER_CALLBACK, array("options"=>"test2")));
var_dump(filter_var("", FILTER_CALLBACK, array("options"=>"test2")));
-/* unsetting data */
-function test3(&$var) {
- unset($var);
-}
-
-var_dump(filter_var("data", FILTER_CALLBACK, array("options"=>"test3")));
-var_dump(filter_var("~!@#$%^&*()_QWERTYUIOPASDFGHJKLZXCVBNM<>>?\"}{:", FILTER_CALLBACK, array("options"=>"test3")));
-var_dump(filter_var("", FILTER_CALLBACK, array("options"=>"test3")));
-
-/* unset data and return value */
-function test4(&$var) {
- unset($var);
- return 1;
-}
-
-var_dump(filter_var("data", FILTER_CALLBACK, array("options"=>"test4")));
-
/* thrown exception in the callback */
-function test5(&$var) {
+function test3($var) {
throw new Exception("test");
}
try {
- var_dump(filter_var("data", FILTER_CALLBACK, array("options"=>"test5")));
+ var_dump(filter_var("data", FILTER_CALLBACK, array("options"=>"test3")));
} catch (Exception $e) {
var_dump($e->getMessage());
}
@@ -94,12 +77,14 @@ string(0) ""
NULL
NULL
NULL
+
+Warning: test2(): Argument #1 ($var) must be passed by reference, value given in %s on line %d
NULL
+
+Warning: test2(): Argument #1 ($var) must be passed by reference, value given in %s on line %d
NULL
+
+Warning: test2(): Argument #1 ($var) must be passed by reference, value given in %s on line %d
NULL
-NULL
-NULL
-NULL
-int(1)
string(4) "test"
Done