From 3942e2a8bdf87a40949788df6e2a92ba40acf2ab Mon Sep 17 00:00:00 2001 From: Andrei Zmievski Date: Sat, 10 Nov 2001 23:45:00 +0000 Subject: Fixed bug #13635. --- ext/pcre/php_pcre.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'ext/pcre') diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 74caa0f0e9..2fee56b755 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -385,7 +385,8 @@ static void php_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global) } /* Calculate the size of the offsets array, and allocate memory for it. */ - num_subpats = pcre_info(re, NULL, NULL) + 1; + pcre_fullinfo(re, extra, PCRE_INFO_CAPTURECOUNT, &num_subpats); + num_subpats++; size_offsets = num_subpats * 3; offsets = (int *)emalloc(size_offsets * sizeof(int)); @@ -434,29 +435,38 @@ static void php_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global) if (global) { /* global pattern matching */ if (subpats_order_val == PREG_PATTERN_ORDER) { - /* For each subpattern, insert it into the appropriate array */ - for (i=0; i