Bug #54083 [Ver]: Lazy match doesn't match more than 99997 characters
Edit report at http://bugs.php.net/bug.php?id=54083&edit=1
ID: 54083
Updated by: aharvey@php.net
Reported by: zequez at gmail dot com
Summary: Lazy match doesn't match more than 99997 characters
Status: Verified
Type: Bug
-Package: Regexps related
+Package: PCRE related
Operating System: Windows 7
PHP Version: 5.3.5
Block user comment: N
Private report: N
New Comment:
Verified on Linux.
Previous Comments:
------------------------------------------------------------------------
[2011-02-24 13:24:06] aharvey@php.net
Verified on Linux.
------------------------------------------------------------------------
[2011-02-24 04:38:33] zequez at gmail dot com
Sorry the misspell, it's lazy, not greedy.
------------------------------------------------------------------------
[2011-02-24 01:26:45] zequez at gmail dot com
Didn't tested in other operative systems...
------------------------------------------------------------------------
[2011-02-24 01:24:01] zequez at gmail dot com
Description:
------------
Greedy match doesn't match more than 99997 characters. If you try to
greedy match
more than 99997 characters it matches nothing.
Test script:
---------------
// 99997 string length
$contents = '';
for ($i = 0; $i < 99997; ++$i) {
$contents .= "a";
}
preg_match('/^a*?$/', $contents, $match);
var_dump($match);
// 99998 string length
$contents = '';
for ($i = 0; $i < 99998; ++$i) {
$contents .= "a";
}
preg_match('/^a*?$/', $contents, $match);
var_dump($match);
Expected result:
----------------
To match the whole $contents content in both cases.
Actual result:
--------------
The first case match the whole $contents content, but in the second one
it match
nothing.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=54083&edit=1
Thread (7 messages)