From: dmitrysp at yandex dot ru
Operating system: Windows 2000/XP
PHP version: 5.2.0
PHP Bug Type: *Regular Expressions
Bug description: /(.?)/ bugs on big string
Description:
------------
Expression "<table>(.*?)</table>" not work with big text string. On PHP 4
& 5.1.2 - all ok. memory_limit = 128M
Reproduce code:
---------------
Windows XP, PHP 5.2.0:
$buf="A".str_repeat("x",9999997)."B"; // 9 999 997
var_dump(preg_match("!A(.*)B!is", $buf, $ok)); // 1
var_dump(preg_match("!A(.*?)B!is", $buf, $ok)); // 0
$buf="A".str_repeat("x",9999996)."B"; // 9 999 996
var_dump(preg_match("!A(.*)B!is", $buf, $ok)); // 1
var_dump(preg_match("!A(.*?)B!is", $buf, $ok)); // 1
Windows 2000, PHP 5.2.0:
$buf="A".str_repeat("x",99997)."B"; // 99 997
var_dump(preg_match("!A(.*)B!is", $buf, $ok)); // 1
var_dump(preg_match("!A(.*?)B!is", $buf, $ok)); // 0
$buf="A".str_repeat("x",99996)."B"; // 99 996
var_dump(preg_match("!A(.*)B!is", $buf, $ok)); // 1
var_dump(preg_match("!A(.*?)B!is", $buf, $ok)); // 1
Windows 2000, PHP 4.4.2:
$buf="A".str_repeat("x",9999997)."B"; // 9 999 997
var_dump(preg_match("!A(.*)B!is", $buf, $ok)); // 1
var_dump(preg_match("!A(.*?)B!is", $buf, $ok)); // 0
$buf="A".str_repeat("x",9999996)."B"; // 9 999 996
var_dump(preg_match("!A(.*)B!is", $buf, $ok)); // 1
var_dump(preg_match("!A(.*?)B!is", $buf, $ok)); // 1
Windows 2000, PHP 5.1.2:
$buf="A".str_repeat("x",9999997)."B"; // 9 999 997
var_dump(preg_match("!A(.*)B!is", $buf, $ok)); // 1
var_dump(preg_match("!A(.*?)B!is", $buf, $ok)); // 0
$buf="A".str_repeat("x",9999996)."B"; // 9 999 996
var_dump(preg_match("!A(.*)B!is", $buf, $ok)); // 1
var_dump(preg_match("!A(.*?)B!is", $buf, $ok)); // 1
Actual result:
--------------
Please up this memory block from 99Kb to <memory_limit> on Windows 2000!
--
Edit bug report at http://bugs.php.net/?id=39459&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=39459&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=39459&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=39459&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=39459&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=39459&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=39459&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=39459&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=39459&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=39459&r=support
Expected behavior: http://bugs.php.net/fix.php?id=39459&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=39459&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=39459&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=39459&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39459&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=39459&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=39459&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=39459&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=39459&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=39459&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=39459&r=mysqlcfg