ID: 46664
Comment by: patrik dot hirvinen at nemein dot com
Reported By: patrik dot hirvinen at nemein dot com
Status: Open
Bug Type: *Regular Expressions
Operating System: Mac OS X 10.5
PHP Version: 5.2.6
New Comment:
Also on at least on linux(debian) with PHP 5.2.0-8+etch11
Previous Comments:
------------------------------------------------------------------------
[2008-11-25 12:08:50] patrik dot hirvinen at nemein dot com
Description:
------------
preg_match fails for some patterns when the searched string exceeds
around 100300 bytes. It matches for same strings if enough text is
removed from the middle part which gets captured by the pattern when
working correctly. Also the exact same regexp works fine for perl on
unshortened output.
Reproduce code:
---------------
<?php
//foo.html >= 100 kB
$contents = file_get_contents("foo.html");
$matches = array();
preg_match('%<BODY\s*>.*?</H[1-6]>(.+?)</BODY>%si', $contents,
$matches);
//$matches is empty
var_dump($matches);
?>
Expected result:
----------------
array(1) {
[0]=>
string(12935) "/*lots of html*/
}
Actual result:
--------------
array(0) {
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=46664&edit=1