From 2f29a1240e8fb16e3d52d43487c3d4f08d86268a Mon Sep 17 00:00:00 2001 From: Arnaud Le Blanc Date: Sun, 2 Nov 2008 22:04:40 +0000 Subject: [PATCH] MFH: Fixed bug #42718 (FILTER_UNSAFE_RAW not applied when configured as default filter) --- NEWS | 2 ++ ext/filter/filter.c | 2 +- ext/filter/tests/bug42718-2.phpt | 20 ++++++++++++++++++++ ext/filter/tests/bug42718.phpt | 22 ++++++++++++++++++++++ 4 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 ext/filter/tests/bug42718-2.phpt create mode 100644 ext/filter/tests/bug42718.phpt diff --git a/NEWS b/NEWS index 6a1b6209e5..bd51b89e24 100644 --- a/NEWS +++ b/NEWS @@ -26,6 +26,8 @@ PHP NEWS - Fixed bug #43452 (strings containing a weekday, or a number plus weekday behaved incorrect of the current day-of-week was the same as the one in the phrase).(Derick) +- Fixed bug #42718 (FILTER_UNSAFE_RAW not applied when configured as default + filter). (Arnaud) - Fixed bug #42294 (Unified solution for round() based on C99 round). (Ilia) - Fixed ability to use "internal" heaps in extensions. (Arnaud, Dmitry) diff --git a/ext/filter/filter.c b/ext/filter/filter.c index 91b89dad78..ed74a44fca 100644 --- a/ext/filter/filter.c +++ b/ext/filter/filter.c @@ -403,7 +403,7 @@ static unsigned int php_sapi_filter(int arg, char *var, char **val, unsigned int Z_STRLEN(new_var) = val_len; Z_TYPE(new_var) = IS_STRING; - if (!(IF_G(default_filter) == FILTER_UNSAFE_RAW)) { + if (IF_G(default_filter) != FILTER_UNSAFE_RAW || IF_G(default_filter_flags) != 0) { zval *tmp_new_var = &new_var; Z_STRVAL(new_var) = estrndup(*val, val_len); INIT_PZVAL(tmp_new_var); diff --git a/ext/filter/tests/bug42718-2.phpt b/ext/filter/tests/bug42718-2.phpt new file mode 100644 index 0000000000..fd2a91d9d4 --- /dev/null +++ b/ext/filter/tests/bug42718-2.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #42718 - 2 (unsafe_raw filter not applied when configured as default filter) +--SKIPIF-- + +--INI-- +magic_quotes_gpc=1 +filter.default=unsafe_raw +filter.default_flags= +--GET-- +a=1%00 +--FILE-- + +--EXPECT-- +unsafe_raw + +1\0 diff --git a/ext/filter/tests/bug42718.phpt b/ext/filter/tests/bug42718.phpt new file mode 100644 index 0000000000..2620d380ed --- /dev/null +++ b/ext/filter/tests/bug42718.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #42718 (unsafe_raw filter not applied when configured as default filter) +--SKIPIF-- + +--INI-- +magic_quotes_gpc=0 +filter.default=unsafe_raw +filter.default_flags=4 +--GET-- +a=1%00 +--FILE-- + +--EXPECT-- +unsafe_raw +4 +bool(true) +1 -- 2.50.1