#39951 [NEW]: PCRE Failed for Long Matches (Less Than MATCH_LIMIT)

From: Date: Tue, 26 Dec 2006 07:20:13 +0000
Subject: #39951 [NEW]: PCRE Failed for Long Matches (Less Than MATCH_LIMIT)
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-106879@lists.php.net to get a copy of this message
From: imacat at mail dot imacat dot idv dot tw Operating system: Linux 2.6.16.29 PHP version: 5.2.0 PHP Bug Type: PCRE related Bug description: PCRE Failed for Long Matches (Less Than MATCH_LIMIT) Description: ------------ Hi. This is imacat from Taiwan. I experienced PCRE failure after long matches. It doesn't seems to pass the 50000 match limit, UTF-8 or not. However, looking into the included PCRE library directory I saw no such limit anywhere. In config0.m4 the setting is -DMATCH_LIMIT=10000000. In pcrelib/README it states that the default of --with-match-limit is 500000. In php.ini I saw pcre.backtrack_limit=100000. Whatever I saw are far less than the 50000 match limit. This is hard to me since I have several articles to be parsed that's of size over 50000 bytes/characters. Reproduce code: --------------- #! /usr/bin/php <?php echo "=== Test #01 Non-UTF-8\n"; $a = str_repeat("a", 49997); echo "1. \"a\" repeated 49997 times\n"; printf(" strlen(): %6d, preg_match(): %d\n", strlen($a), preg_match("/^(.*?)\s*$/us", $a)); $a = str_repeat("a", 49998); echo "2. \"a\" repeated 49998 times\n"; printf(" strlen(): %6d, preg_match(): %d\n", strlen($a), preg_match("/^(.*?)\s*$/us", $a)); echo "=== Test #02 UTF-8\n"; $a = str_repeat("\xE4\xB8\x80", 49997); echo "1. \"\\xE4\\xB8\\x80\" repeated 49997 times\n"; printf(" strlen(): %6d, preg_match(): %d\n", strlen($a), preg_match("/^(.*?)\s*$/us", $a)); $a = str_repeat("\xE4\xB8\x80", 49998); echo "2. \"\\xE4\\xB8\\x80\" repeated 49998 times\n"; printf(" strlen(): %6d, preg_match(): %d\n", strlen($a), preg_match("/^(.*?)\s*$/us", $a)); ?> Expected result: ---------------- === Test #01 Non-UTF-8 1. "a" repeated 49997 times strlen(): 49997, preg_match(): 1 2. "a" repeated 49998 times strlen(): 49998, preg_match(): 0 === Test #02 UTF-8 1. "\xE4\xB8\x80" repeated 49997 times strlen(): 149991, preg_match(): 1 2. "\xE4\xB8\x80" repeated 49998 times strlen(): 149994, preg_match(): 0 Actual result: -------------- === Test #01 Non-UTF-8 1. "a" repeated 49997 times strlen(): 49997, preg_match(): 1 2. "a" repeated 49998 times strlen(): 49998, preg_match(): 1 === Test #02 UTF-8 1. "\xE4\xB8\x80" repeated 49997 times strlen(): 149991, preg_match(): 1 2. "\xE4\xB8\x80" repeated 49998 times strlen(): 149994, preg_match(): 1 -- Edit bug report at http://bugs.php.net/?id=39951&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39951&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39951&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39951&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=39951&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=39951&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=39951&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=39951&r=needscript Try newer version: http://bugs.php.net/fix.php?id=39951&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=39951&r=support Expected behavior: http://bugs.php.net/fix.php?id=39951&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=39951&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=39951&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=39951&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39951&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=39951&r=dst IIS Stability: http://bugs.php.net/fix.php?id=39951&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=39951&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=39951&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=39951&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=39951&r=mysqlcfg

« previous php.bugs (#106879) next »