#39459 [Opn->Bgs]: /(.?)/ bugs on big string

From: Date: Fri, 10 Nov 2006 12:35:22 +0000
Subject: #39459 [Opn->Bgs]: /(.?)/ bugs on big string
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-104746@lists.php.net to get a copy of this message
ID: 39459 Updated by: tony2001@php.net Reported By: dmitrysp at yandex dot ru -Status: Open +Status: Bogus Bug Type: *Regular Expressions Operating System: Windows 2000/XP PHP Version: 5.2.0 New Comment: It has nothing to do with memory_limit, it's MATCH_LIMIT set in PCRE library in compile time. You can change it on *nix, but you have to live with that on win32, unless you want to build PHP on win32 yourself. Previous Comments: ------------------------------------------------------------------------ [2006-11-10 12:21:25] dmitrysp at yandex dot ru 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 this bug report at http://bugs.php.net/?id=39459&edit=1

« previous php.bugs (#104746) next »