From: Andrei Zmievski Date: Mon, 22 Jan 2001 22:05:04 +0000 (+0000) Subject: If we can't call custom replacement function, don't change the subject X-Git-Tag: php-4.0.5RC1~489 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b56006b5b23574e19b766c4556a5193dcbb77146;p=php If we can't call custom replacement function, don't change the subject string. --- 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);