Bug #54083 [NEW]: Greedy match doesn't match more than 99997 characters
| From: | zequez at gmail dot com | Date: | Thu, 24 Feb 2011 00:24:02 +0000 |
| Subject: | Bug #54083 [NEW]: Greedy match doesn't match more than 99997 characters | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-158985@lists.php.net to get a copy of this message | ||
From:
Operating system:
PHP version: 5.3.5
Package: Regexps related
Bug Type: Bug
Bug description:Greedy match doesn't match more than 99997 characters
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 bug report at http://bugs.php.net/bug.php?id=54083&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54083&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54083&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54083&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=54083&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54083&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=54083&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=54083&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=54083&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=54083&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=54083&r=support
Expected behavior: http://bugs.php.net/fix.php?id=54083&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=54083&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=54083&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=54083&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54083&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=54083&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=54083&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=54083&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=54083&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=54083&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=54083&r=mysqlcfg