summaryrefslogtreecommitdiff
path: root/ext/pcre/php_pcre.c
diff options
context:
space:
mode:
authorAndrei Zmievski <andrei@php.net>2001-01-22 22:05:04 +0000
committerAndrei Zmievski <andrei@php.net>2001-01-22 22:05:04 +0000
commitb56006b5b23574e19b766c4556a5193dcbb77146 (patch)
treeb684a793ceca04ee40fefc8361bd80bfbc112cc3 /ext/pcre/php_pcre.c
parent63f73bfe13d915020b0a8726d9c7fb635ed23536 (diff)
downloadphp-git-b56006b5b23574e19b766c4556a5193dcbb77146.tar.gz
If we can't call custom replacement function, don't change the subject
string.
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);