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.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index 69acdda7f3..ebdaabfbf7 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -587,8 +587,8 @@ static int preg_do_repl_func(char *function_name, char *subject, int *offsets, i
zval_ptr_dtor(&retval_ptr);
} else {
php_error(E_WARNING, "Unable to call custom replacement function %s()", function_name);
- *result = empty_string;
- result_len = 0;
+ result_len = offsets[1] - offsets[0];
+ *result = estrndup(&subject[offsets[0]], result_len);
}
zval_dtor(subpats);
FREE_ZVAL(subpats);