]> granicus.if.org Git - php/commitdiff
@- Fixed a bug that did not respect limit parameter in preg_replace() when
authorAndrei Zmievski <andrei@php.net>
Thu, 24 Aug 2000 13:23:13 +0000 (13:23 +0000)
committerAndrei Zmievski <andrei@php.net>
Thu, 24 Aug 2000 13:23:13 +0000 (13:23 +0000)
@  using /e modifier. (Andrei)

ext/pcre/php_pcre.c

index 4641067904e8c23d60085bdd6e4c5965c60bddc1..7c6f75b47754341ff3fff122c3880b614b896e6e 100644 (file)
@@ -720,10 +720,11 @@ char *php_pcre_replace(char *regex,   int regex_len,
                                *walkbuf = '\0';
                                /* increment the result length by how much we've added to the string */
                                *result_len += walkbuf - (result + *result_len);
-
-                               if (limit != -1)
-                                       limit--;
                        }
+
+                       if (limit != -1)
+                               limit--;
+
                } else { /* Failed to match */
                        /* If we previously set PCRE_NOTEMPTY after a null match,
                           this is not necessarily the end. We need to advance