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

From: Date: Sun, 23 Aug 2015 13:44:34 +0000
Subject: Doc #70328 [Opn->Ver]: 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-12642@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: Open +Status: Verified Type: Documentation Problem Package: Documentation problem Operating System: win10 PHP Version: 5.6.12 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: 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> Previous Comments: ------------------------------------------------------------------------ [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 (#12642) next »