Doc #70328 [Ver->Csd]: wrong value of the maximum number of captured substrings in Subpatterns

From: Date: Sun, 23 Aug 2015 13:54:27 +0000
Subject: Doc #70328 [Ver->Csd]: wrong value of the maximum number of captured substrings in Subpatterns
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-12643@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70328&edit=1 ID: 70328 Updated by: cmb@php.net Reported by: jhdxr@php.net Summary: wrong value of the maximum number of captured substrings in Subpatterns -Status: Verified +Status: Closed Type: Documentation Problem Package: Documentation problem Operating System: win10 PHP Version: 5.6.12 Assigned To: cmb Block user comment: N Private report: N New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. Previous Comments: ------------------------------------------------------------------------ [2015-08-23 13:53:53] cmb@php.net Automatic comment from SVN on behalf of cmb Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=337592 Log: maximum number of captured substrings may not be reachable (fixes #70328) ------------------------------------------------------------------------ [2015-08-23 13:44:30] cmb@php.net The info in the PHP manual is likely to be based on this changelog[1] entry for PCRE 3.5: | 13. The limit of 99 on the number of capturing subpatterns has | been removed. The new limit is 65535, which I hope will not be a | "real" limit. However, the error "regular expression is too large" is caused by a compiled pattern exceeding a given size limit, see <http://www.pcre.org/original/doc/html/pcrebuild.html#SEC12>. Compiling a custom libpcre --with-link-size=3 and using this one, makes the test script succeed. [1] <http://www.pcre.org/original/changelog.txt> ------------------------------------------------------------------------ [2015-08-22 17:43:25] jhdxr@php.net Description: ------------ As reported in #67576 , the doc says "The maximum number of captured substrings is 65535. ". However, the test script failed. It raised a warning: > Warning: preg_match(): Compilation failed: regular expression is too large at offset 21000 and followed by the instructions in #67576 , if I edit 7000 to 6552, everything works. So is it a documentation problem or I misunderstand something? Test script: --------------- <?php ini_set("pcre.backtrack_limit", -1); ini_set("pcre.recursion_limit", -1); $test2 = str_repeat('a',10000); //7000 is much smaller than 65535 if (preg_match('/'.str_repeat('(a)',7000).'/', $test2, $regs2)) { var_dump($regs2); } else { echo 'Not find'; } Expected result: ---------------- output the results of preg_match Actual result: -------------- Warning: preg_match(): Compilation failed: regular expression is too large at offset 21000 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=70328&edit=1

« previous php.doc.bugs (#12643) next »