From:             nuitari at nuitari dot net
Operating system: Linux
PHP version:      5.0.5
PHP Bug Type:     PCRE related
Bug description:  Problem when a parenthesised sub exp matches >= 4999996 chars

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 bug report at http://bugs.php.net/?id=34720&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=34720&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=34720&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=34720&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=34720&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=34720&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=34720&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=34720&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=34720&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=34720&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=34720&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=34720&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=34720&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=34720&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=34720&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=34720&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=34720&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=34720&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=34720&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=34720&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=34720&r=mysqlcfg

Reply via email to