#42543 [NEW]: PHP 5.2.3 and 5.2.4 preg_match will fail to match strings exceeding 480 chars
From: laurent at 2mx dot fr
Operating system: Debian 4.0 etch
PHP version: 5.2.4
PHP Bug Type: PCRE related
Bug description: PHP 5.2.3 and 5.2.4 preg_match will fail to match strings exceeding 480 chars
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 bug report at http://bugs.php.net/?id=42543&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42543&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42543&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42543&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=42543&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=42543&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=42543&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=42543&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=42543&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=42543&r=support
Expected behavior: http://bugs.php.net/fix.php?id=42543&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=42543&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=42543&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=42543&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42543&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=42543&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=42543&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=42543&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=42543&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=42543&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=42543&r=mysqlcfg
Thread (2 messages)
- laurent at 2mx dot fr