#47662 [Com]: Crash with more that 63 named Subpattern

[email protected] ("mmcnicklebugs at googlemail dot com")
Newsgroups php.bugs
Message-ID <[email protected]>
 ID:               47662
 Comment by:       mmcnicklebugs at googlemail dot com
 Reported By:      gmblar+php at gmail dot com
 Status:           Open
 Bug Type:         PCRE related
 Operating System: MacOSX 10.5
 PHP Version:      5.2.9
 New Comment:

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


Previous Comments:
------------------------------------------------------------------------

[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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.