diff options
author | Antony Dovgal <tony2001@php.net> | 2005-12-06 15:16:33 +0000 |
---|---|---|
committer | Antony Dovgal <tony2001@php.net> | 2005-12-06 15:16:33 +0000 |
commit | a317347723174981b961825ee30b3314b11cc08c (patch) | |
tree | 3f86e6210a8e013c306a2ecb2de26ad9c2069d88 | |
parent | b35b72f9ed0ac2caa2ed207bf311f49e59208e82 (diff) | |
download | php-git-a317347723174981b961825ee30b3314b11cc08c.tar.gz |
accept strings and arrays as callback name
-rw-r--r-- | ext/filter/filter.c | 44 |
1 files changed, 30 insertions, 14 deletions
diff --git a/ext/filter/filter.c b/ext/filter/filter.c index 2249fd769b..f618cd12e9 100644 --- a/ext/filter/filter.c +++ b/ext/filter/filter.c @@ -635,22 +635,38 @@ PHP_FUNCTION(filter_data) return; } - if (flags) { - switch (Z_TYPE_P(flags)) { - case IS_ARRAY: - options = flags; - break; - - case IS_STRING: - case IS_BOOL: - case IS_LONG: - convert_to_long(flags); - filter_flags = Z_LVAL_P(flags); - options = NULL; - break; + if (filter != FC_CALLBACK) { + if (flags) { + switch (Z_TYPE_P(flags)) { + case IS_ARRAY: + options = flags; + break; + + case IS_STRING: + case IS_BOOL: + case IS_LONG: + convert_to_long(flags); + filter_flags = Z_LVAL_P(flags); + options = NULL; + break; + } + } + } + else { + if (flags) { + switch (Z_TYPE_P(flags)) { + case IS_ARRAY: + case IS_STRING: + options = flags; + break; + + default: + convert_to_string(flags); + options = flags; + break; + } } } - php_zval_filter_recursive(var, filter, filter_flags, options, charset TSRMLS_CC); RETURN_ZVAL(var, 1, 0); } |