]> granicus.if.org Git - php/commitdiff
If we can't call custom replacement function, don't change the subject
authorAndrei Zmievski <andrei@php.net>
Mon, 22 Jan 2001 22:05:04 +0000 (22:05 +0000)
committerAndrei Zmievski <andrei@php.net>
Mon, 22 Jan 2001 22:05:04 +0000 (22:05 +0000)
string.

ext/pcre/php_pcre.c

index 69acdda7f3a4035c3ca6f8d96b2f8655205cdd5a..ebdaabfbf78d1da7105793013f869f3774fbb585 100644 (file)
@@ -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);