#47662 [Opn->Fbk]: Crash with more that 63 named Subpattern
ID: 47662
Updated by: jani@php.net
Reported By: gmblar+php at gmail dot com
-Status: Open
+Status: Feedback
Bug Type: PCRE related
Operating System: MacOSX 10.5
PHP Version: 5.2.9
New Comment:
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php
for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php
for Win32
Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2009-03-26 15:02:00] mmcnicklebugs at googlemail dot com
I can't replicate on Linux/Ubuntu 8.04 with 5.3CVS or 5.2.*
When I increase the number of patterns to a large number (say 60000) I
get a suitable warning:
Warning: preg_match(): Compilation failed: too many named subpatterns
(maximum 10000) at offset 148903 in
/home/martin/php_bugs/pcre/47622/test.php on line 10
------------------------------------------------------------------------
[2009-03-15 14:37:22] gmblar+php at gmail dot com
Description:
------------
With more than 63 Subpattern in a Regular-Expression, PHP crashes with
a
Segmention-Fault.
Reproduce code:
---------------
<?php
$regex = '@';
// works with $bar<63
for($bar=0; $bar<64; $bar++) {
$regex .= '((?P<foo'.$bar.'>))';
}
$regex .= '@';
preg_match($regex, 'foobar');
?>
Expected result:
----------------
Nothing
Actual result:
--------------
$ php foobar.php
Segmentation fault
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47662&edit=1
Thread (7 messages)