summaryrefslogtreecommitdiff
path: root/ext/pcre/php_pcre.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pcre/php_pcre.c')
-rw-r--r--ext/pcre/php_pcre.c9
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) {