#33468 [Fbk->Opn]: preg_match on long strings fails
| From: | mjsherman at chartermi dot net | Date: | Fri, 24 Jun 2005 17:21:23 +0000 |
| Subject: | #33468 [Fbk->Opn]: preg_match on long strings fails | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-80983@lists.php.net to get a copy of this message | ||
ID: 33468
User updated by: mjsherman at chartermi dot net
Reported By: mjsherman at chartermi dot net
-Status: Feedback
+Status: Open
Bug Type: PCRE related
Operating System: Linux
PHP Version: 4.3.11
New Comment:
Just tested with 5.1.0beta2
Same problem.
Previous Comments:
------------------------------------------------------------------------
[2005-06-24 18:28:01] tony2001@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5-win32-latest.zip
------------------------------------------------------------------------
[2005-06-24 18:24:34] mjsherman at chartermi dot net
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 this bug report at http://bugs.php.net/?id=33468&edit=1