diff options
author | Andrei Zmievski <andrei@php.net> | 2002-01-15 15:40:31 +0000 |
---|---|---|
committer | Andrei Zmievski <andrei@php.net> | 2002-01-15 15:40:31 +0000 |
commit | d0ed5b984c2eb5a6530f78b2e478cfcd10e15de8 (patch) | |
tree | 9ab394a6f7092828dbb72b3ba106c11c10050e79 /ext/pcre/php_pcre.c | |
parent | c7b5155fdc3428d93b3bcddbe7298a4143b9c45e (diff) | |
download | php-git-d0ed5b984c2eb5a6530f78b2e478cfcd10e15de8.tar.gz |
- Fixed a bug with matching string containing null bytes.
Diffstat (limited to 'ext/pcre/php_pcre.c')
-rw-r--r-- | ext/pcre/php_pcre.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 47c4f082bd..7d588cc10b 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -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); } } |