From d73ef1242986f84a7bb9e6fa088f19d4f22b05dc Mon Sep 17 00:00:00 2001 From: Andrei Zmievski Date: Mon, 12 Mar 2001 03:06:53 +0000 Subject: @- 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. --- ext/pcre/php_pcre.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'ext/pcre/php_pcre.c') 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) { -- cgit v1.2.1