]> granicus.if.org Git - php/commitdiff
- Fixed a bug with matching string containing null bytes.
authorAndrei Zmievski <andrei@php.net>
Tue, 15 Jan 2002 15:40:31 +0000 (15:40 +0000)
committerAndrei Zmievski <andrei@php.net>
Tue, 15 Jan 2002 15:40:31 +0000 (15:40 +0000)
NEWS
ext/pcre/php_pcre.c

diff --git a/NEWS b/NEWS
index dc63126c1346276ae0c1fd4812704ddf89145caa..c46d63dba1a35673afc6b410ad9d064d79cb64b4 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,8 @@
 PHP 4                                                                      NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 200?, Version 4.2.0-dev
+- Fixed a bug in preg_match()/preg_match_all() when matching strings containing
+  null bytes. (Andrei)
 - Added xpath_register_ns() function.
   It makes possible to issue XPath queries with namespaces
   like for example: "//namespace:sampletag" (Chris Jarecki)
index 47c4f082bda7f0536c482d716d3cfc289a28628d..7d588cc10ba4eb54814ca9d33019e8414c205459 100644 (file)
@@ -440,7 +440,8 @@ static void php_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global)
                                        if (subpats_order_val == PREG_PATTERN_ORDER) {
                                                /* For each subpattern, insert it into the appropriate array. */
                                                for (i = 0; i < count; i++) {
-                                                       add_next_index_string(match_sets[i], (char *)stringlist[i], 1);
+                                                       add_next_index_stringl(match_sets[i], (char *)stringlist[i],
+                                                                                                  offsets[(i<<1)+1] - offsets[i<<1], 1);
                                                }
                                                /*
                                                 * If the number of captured subpatterns on this run is
@@ -460,7 +461,8 @@ static void php_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global)
                                                
                                                /* Add all the subpatterns to it */
                                                for (i = 0; i < count; i++) {
-                                                       add_next_index_string(result_set, (char *)stringlist[i], 1);
+                                                       add_next_index_stringl(result_set, (char *)stringlist[i],
+                                                                                                  offsets[(i<<1)+1] - offsets[i<<1], 1);
                                                }
                                                /* And add it to the output array */
                                                zend_hash_next_index_insert(Z_ARRVAL_PP(subpats), &result_set,
@@ -470,7 +472,8 @@ static void php_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global)
                                else {                  /* single pattern matching */
                                        /* For each subpattern, insert it into the subpatterns array. */
                                        for (i = 0; i < count; i++) {
-                                               add_next_index_string((*subpats), (char *)stringlist[i], 1);
+                                               add_next_index_stringl((*subpats), (char *)stringlist[i],
+                                                                                          offsets[(i<<1)+1] - offsets[i<<1], 1);
                                        }
                                }