|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38597 preg_match with long match returns blanc page
Submitted: 2006-08-25 19:59 UTC Modified: 2006-08-25 20:35 UTC
From: koen dot devreeze at gmail dot com Assigned:
Status: Closed Package: PCRE related
PHP Version: 5.1.5 OS: Windows XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: koen dot devreeze at gmail dot com
New email:
PHP Version: OS:


 [2006-08-25 19:59 UTC] koen dot devreeze at gmail dot com
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>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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-25 20:21 UTC]
Please try using this CVS snapshot:
For Windows:

 [2006-08-25 20:33 UTC] koen dot devreeze at gmail dot com
The problem is fixed in cvs snapshot of php 5.2.
 [2006-08-25 20:35 UTC] koen dot devreeze at gmail dot com
Closing bug report
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Oct 17 10:03:37 2021 UTC