From b56006b5b23574e19b766c4556a5193dcbb77146 Mon Sep 17 00:00:00 2001 From: Andrei Zmievski Date: Mon, 22 Jan 2001 22:05:04 +0000 Subject: If we can't call custom replacement function, don't change the subject string. --- ext/pcre/php_pcre.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ext/pcre/php_pcre.c') 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); -- cgit v1.2.1