diff options
author | Andrei Zmievski <andrei@php.net> | 2001-03-12 03:06:53 +0000 |
---|---|---|
committer | Andrei Zmievski <andrei@php.net> | 2001-03-12 03:06:53 +0000 |
commit | d73ef1242986f84a7bb9e6fa088f19d4f22b05dc (patch) | |
tree | 9c64de3a3ae754aab5226d151403886c5896e4a4 /ext/pcre/php_pcre.c | |
parent | 2d54fb39b957cc0ca973d0cbb5d1869567c2df76 (diff) | |
download | php-git-d73ef1242986f84a7bb9e6fa088f19d4f22b05dc.tar.gz |
@- Added array_reduce(), which allows iterative reduction of an array
@ to a single value via a callback function. (Andrei)
- Added array_reduce(), which allows iterative reduction of an array
to a single value via a callback function.
- Fixed usage of zend_is_callable() in PCRE.
Diffstat (limited to 'ext/pcre/php_pcre.c')
-rw-r--r-- | ext/pcre/php_pcre.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index b65a35600f..eaba8e6fcf 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -726,8 +726,11 @@ char *php_pcre_replace(char *regex, int regex_len, /* Verify and use the replacement value. */ if (use_func) { - if (!zend_is_callable(replace_val)) { - php_error(E_WARNING, "Replacement function is invalid or undefined"); + char *callable_name; + + if (!zend_is_callable(replace_val, 0, &callable_name)) { + php_error(E_WARNING, "Replacement callback '%s' is invalid or undefined", callable_name); + efree(callable_name); result = estrndup(subject, subject_len); *result_len = subject_len; return result; @@ -1009,7 +1012,7 @@ PHP_FUNCTION(preg_replace) if (Z_TYPE_PP(replace) != IS_ARRAY) { convert_to_string_ex(replace); } else - is_callable_replace = zend_is_callable(*replace); + is_callable_replace = zend_is_callable(*replace, 1, NULL); /* if subject is an array */ if (Z_TYPE_PP(subject) == IS_ARRAY) { |