diff options
author | Nuno Lopes <nlopess@php.net> | 2006-06-15 15:33:25 +0000 |
---|---|---|
committer | Nuno Lopes <nlopess@php.net> | 2006-06-15 15:33:25 +0000 |
commit | c3ed91477a011e494559d6f65301ef6b2e38cd22 (patch) | |
tree | a86b3f06162247c31e1a2b5bed77784f673977ff /ext/pcre/php_pcre.c | |
parent | 954acfe261a208c10f67cb5dcff14da7b057509b (diff) | |
download | php-git-c3ed91477a011e494559d6f65301ef6b2e38cd22.tar.gz |
fix bug #37800: preg_replace() limit parameter odd behaviour
#this is a regression in PHP_5_2 and HEAD branches only
Diffstat (limited to 'ext/pcre/php_pcre.c')
-rw-r--r-- | ext/pcre/php_pcre.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 58225eb09e..e4dee71d4c 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -1091,7 +1091,7 @@ PHPAPI char *php_pcre_replace(char *regex, int regex_len, if (limit != -1) limit--; - } else if (count == PCRE_ERROR_NOMATCH) { + } else if (count == PCRE_ERROR_NOMATCH || limit == 0) { /* If we previously set PCRE_NOTEMPTY after a null match, this is not necessarily the end. We need to advance the start offset, and continue. Fudge the offset values |