php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41107 (.+?) will not match greater than 99,997 bytes
Submitted: 2007-04-17 00:24 UTC Modified: 2007-04-17 01:53 UTC
From: brianm at dealnews dot com Assigned:
Status: Not a bug Package: PCRE related
PHP Version: 5.2.1 OS: Mac and Linux
Private report: No CVE-ID: None
 [2007-04-17 00:24 UTC] brianm at dealnews dot com
Description:
------------
Before submitting a bug, I consulted with Phillip Hazel, the maintainer of PCRE.  He tested up to over 400k of data with PCRE and had no problems.  So, I am thinking this is a PHP issue.

Basically, (.+?) will not match over 99,997 bytes.  This worked in PHP 5.0 and all previous versions I have used.

Reproduce code:
---------------
<?php

$string = "<tag>".str_repeat("x", 99997)."</tag>";

if(preg_match('/<tag>(.+?)<\/tag>/', $string, $match)){
    echo "Match 99997!\n";
}


$string = "<tag>".str_repeat("x", 99998)."</tag>";

if(preg_match('/<tag>(.+?)<\/tag>/', $string, $match)){
    echo "Match 99998!\n";
}

?>

Expected result:
----------------
Match 99997!
Match 99998!

Actual result:
--------------
Match 99997!


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-04-17 01:53 UTC] scottmac@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

pcre.backtrack_limit was added in PHP 5.2.0 this corresponds to PCRE_EXTRA_MATCH_LIMIT or PCRE which limits the number of matches and by default its 10,000.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 06:01:30 2024 UTC