ID: 34720
Updated by: [EMAIL PROTECTED]
Reported By: nuitari at nuitari dot net
-Status: Bogus
+Status: Open
-Bug Type: PCRE related
+Bug Type: Documentation problem
Operating System: Linux
PHP Version: 5.0.5
New Comment:
That's up for the docteam to decide...
Previous Comments:
------------------------------------------------------------------------
[2005-10-03 23:46:10] nuitari at nuitari dot net
Would it be possible to document this in the pcre functions manual ?
------------------------------------------------------------------------
[2005-10-03 22:10:21] [EMAIL PROTECTED]
This is a PCRE limitation,
See bug #34695 for detailed explanation.
------------------------------------------------------------------------
[2005-10-03 21:39:09] nuitari at nuitari dot net
Description:
------------
If a paranthesised sub expression matches more then ~4999996 chars, no
data will be inserted into the &matches array.
Reducing by 1 the number in str_repeat will cause the script to work.
I have tested this with PHP 4.4.0-gentoo-amd64, 5.0.4-FC4, and
5.0.5-gentoo and all exhebit the same problems.
The configure line is different on all platforms. php.ini is the
default. On the FC4 test there is a 512Mb memory limit.
Reproduce code:
---------------
<?php
$xml_clean = '<data>';
$xml_clean .= str_repeat('a',4999996);
$xml_clean .= '</data>';
$ret = preg_match("/(<([\w]+)[^>]*>)(.*?)(<\/\\2>)/s", $xml_clean,
$match);
print_r($match);
?>
Expected result:
----------------
Array
(
[0] => <data>aaa(...)aaa</data>
[1] => <data>
[2] => data
[3] => aaa(...)aaa
[4] => </data>
)
Actual result:
--------------
Array
(
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34720&edit=1