|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
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: Tue Nov 30 13:03:49 2021 UTC