#38597 [Opn->Fbk]: preg_match with long match returns blanc page
| From: | edink@php.net | Date: | Fri, 25 Aug 2006 20:21:55 +0000 |
| Subject: | #38597 [Opn->Fbk]: preg_match with long match returns blanc page | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-101342@lists.php.net to get a copy of this message | ||
ID: 38597
Updated by: edink@php.net
Reported By: koen dot devreeze at gmail dot com
-Status: Open
+Status: Feedback
Bug Type: PCRE related
Operating System: Windows XP
PHP Version: 5.1.5
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.2-win32-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2006-08-25 19:59:49] koen dot devreeze at gmail dot com
Description:
------------
When processing this code. The parsing ends on the preg_match
function.
$t has 475 characters in it. Remove one char and the script works
again.
PS.: This was also tested with php 5.1.4 on gentoo linux without any
problems.
Reproduce code:
---------------
$t =
"---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------";
$text = "
<p>".$t."</p>
<p>Some text doesn't matter how long</p>
";
//echo strlen($t);
$pattern = '/<p([a-z "=]*)?>((.)*?)<(\/)?p>/';
preg_match($pattern, $text, $paragraphs) or die("died");
echo $paragraphs[0];
Expected result:
----------------
$t should be displayed no matter how many chars it has (though
considering limitation of PCRE).
Actual result:
--------------
Script ends on preg_match after a few seconds of 100% CPU load. No
errors no crashes.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=38597&edit=1