From: adam-phpbugs at adam dot gs
Operating system: Any
PHP version: 5.2.3
PHP Bug Type: PCRE related
Bug description: PHP5/PCRE fails to match long strings when ungreedy
Description:
------------
PHP5/PCRE will fail to match on long strings when UNGREEDY, the boundary
is around 100k of data.
FWIW, same results if you change x* to x+ down there.
Reproduce code:
---------------
<?php
$data=sprintf("<span>%s</span>",str_repeat("x",99996));
var_dump(preg_match("#<span>(x*?)</span>#",$data));
$data=sprintf("<span>%s</span>",str_repeat("x",99997));
var_dump(preg_match("#<span>(x*?)</span>#",$data));
$data=sprintf("<span>%s</span>",str_repeat("x",99997));
var_dump(preg_match("#<span>(x*)</span>#U",$data));
$data=sprintf("<span>%s</span>",str_repeat("x",99997));
var_dump(preg_match("#<span>(x*)</span>#",$data));
?>
Expected result:
----------------
all 4 expressions should match, this is what occurs with PHP 4.4.7.
Actual result:
--------------
under PHP 5.2.3:
only the first and 4th expression match
under PHP 4.4.7:
all 4 match.
--
Edit bug report at http://bugs.php.net/?id=42424&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=42424&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=42424&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=42424&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=42424&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=42424&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=42424&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=42424&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=42424&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=42424&r=support
Expected behavior: http://bugs.php.net/fix.php?id=42424&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=42424&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=42424&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=42424&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42424&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=42424&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=42424&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=42424&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=42424&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=42424&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=42424&r=mysqlcfg