#33468 [NEW]: preg_match on long strings fails
| From: | mjsherman at chartermi dot net | Date: | Fri, 24 Jun 2005 16:24:34 +0000 |
| Subject: | #33468 [NEW]: preg_match on long strings fails | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-80981@lists.php.net to get a copy of this message | ||
From: mjsherman at chartermi dot net
Operating system: Linux
PHP version: 4.3.11
PHP Bug Type: PCRE related
Bug description: preg_match on long strings fails
Description:
------------
preg_match, if passed a long subject string, fails unexpectedly.
I have read through the PCRE limitations, and can't see that this is one
of them. I have tried increasing memory limit (to increase the stack)
with the same results.
Cutoff and examples are below:
Reproduce code:
---------------
$subject = str_repeat('a',100);
$subject .= str_repeat('b', 4370);
$subject .= str_repeat('a', 100);
if (preg_match('/(.*).*?\1/',$subject)) {
echo "OK\n";
}
Expected result:
----------------
"OK" to be printed after matching 100 "a"s.
If 4370 is changed to 4369, then "OK" is printed.
Actual result:
--------------
With 4370 'b's, nothing is printed (failed preg_match)
With 4369 'b's, "OK" is printed (worked).
--
Edit bug report at http://bugs.php.net/?id=33468&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33468&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33468&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33468&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=33468&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=33468&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=33468&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=33468&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=33468&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=33468&r=support
Expected behavior: http://bugs.php.net/fix.php?id=33468&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=33468&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=33468&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=33468&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33468&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=33468&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=33468&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=33468&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=33468&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=33468&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=33468&r=mysqlcfg