#42543 [Opn->Bgs]: PHP 5.2.3 and 5.2.4 preg_match will fail to match strings exceeding 480 chars
| From: | johannes@php.net | Date: | Tue, 04 Sep 2007 14:34:04 +0000 |
| Subject: | #42543 [Opn->Bgs]: PHP 5.2.3 and 5.2.4 preg_match will fail to match strings exceeding 480 chars | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-117110@lists.php.net to get a copy of this message | ||
ID: 42543
Updated by: johannes@php.net
Reported By: laurent at 2mx dot fr
-Status: Open
+Status: Bogus
Bug Type: PCRE related
Operating System: Debian 4.0 etch
PHP Version: 5.2.4
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Please check preg_last_error()
Previous Comments:
------------------------------------------------------------------------
[2007-09-04 14:07:46] laurent at 2mx dot fr
Description:
------------
PHP 5.2.3 and 5.2.4 preg_match will fail to match strings exceeding 480
chars while it is working correctly with php 5.2.0
I'm using the bundled PCRE library
I have change the pcre.backtrack_limit but it didn't fix the problem
This is the same behavior with preg_replace_callback: the call back
function doesn't get called.
Reproduce code:
---------------
<?php
$regex = ';^<code(\s[^>]*)?>((?:(?R)|.)*?)\n</code>(\s|$);msi';
$texte = '
<code type="php">
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
</code>
';
echo preg_match($regex, $texte);
?>
Expected result:
----------------
preg_match should return 1
Actual result:
--------------
preg_match
return 0 on php 5.2.4 and 5.2.3 while I'm expecting 1
return 1 on php 5.2.0 -> OK
If I remove one char "a" on the last line
preg_match
return 0 on php 5.2.4 and 5.2.3 -> OK
return 1 on php 5.2.0 -> OK
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42543&edit=1