Bug #54083 [Com]: Lazy match doesn't match more than 99997 characters
| From: | carsten_sttgt at gmx dot de | Date: | Sat, 26 Feb 2011 14:14:32 +0000 |
| Subject: | Bug #54083 [Com]: Lazy match doesn't match more than 99997 characters | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-159063@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=54083&edit=1
ID: 54083
Comment by: carsten_sttgt at gmx dot de
Reported by: zequez at gmail dot com
Summary: Lazy match doesn't match more than 99997 characters
Status: Verified
Type: Bug
Package: PCRE related
Operating System: Windows 7
PHP Version: 5.3.5
Block user comment: N
Private report: N
New Comment:
The default pcre.backtrack_limit of 100000 from PHP is to low for this
regex.
With the PCRE default (10000000) the above regex is working.
Previous Comments:
------------------------------------------------------------------------
[2011-02-24 13:24:15] aharvey@php.net
Verified on Linux.
------------------------------------------------------------------------
[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