What's your rationale for this fix? What sort of regression happened?

-Andrei


On Jun 15, 2006, at 11:33 AM, Nuno Lopes wrote:

nlopess         Thu Jun 15 15:33:25 2006 UTC

  Added files:                 (Branch: PHP_5_2)
    /php-src/ext/pcre/tests     bug37800.phpt

  Modified files:
    /php-src/ext/pcre   php_pcre.c
  Log:
  fix bug #37800: preg_replace() limit parameter odd behaviour
  #this is a regression in PHP_5_2 and HEAD branches only

http://cvs.php.net/viewcvs.cgi/php-src/ext/pcre/php_pcre.c? r1=1.168.2.9.2.5&r2=1.168.2.9.2.6&diff_format=u
Index: php-src/ext/pcre/php_pcre.c
diff -u php-src/ext/pcre/php_pcre.c:1.168.2.9.2.5 php-src/ext/pcre/ php_pcre.c:1.168.2.9.2.6
--- php-src/ext/pcre/php_pcre.c:1.168.2.9.2.5   Wed Jun 14 17:52:56 2006
+++ php-src/ext/pcre/php_pcre.c Thu Jun 15 15:33:25 2006
@@ -16,7 +16,7 @@
+--------------------------------------------------------------------- -+
  */

-/* $Id: php_pcre.c,v 1.168.2.9.2.5 2006/06/14 17:52:56 nlopess Exp $ */ +/* $Id: php_pcre.c,v 1.168.2.9.2.6 2006/06/15 15:33:25 nlopess Exp $ */

 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -1091,7 +1091,7 @@
                        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

http://cvs.php.net/viewcvs.cgi/php-src/ext/pcre/tests/bug37800.phpt? view=markup&rev=1.1
Index: php-src/ext/pcre/tests/bug37800.phpt
+++ php-src/ext/pcre/tests/bug37800.phpt

--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to