PHP 4.0 Bug #5545: regular expression matching goes into almost infinite loop

From: Date: Thu, 13 Jul 2000 05:03:50 +0000
Subject: PHP 4.0 Bug #5545: regular expression matching goes into almost infinite loop
Groups: php.dev 
Request: Send a blank email to php-dev+get-24259@lists.php.net to get a copy of this message
From: elkan@cs.ucsd.edu Operating system: Mandrake Linux 7.0r2 PHP version: 4.0 Release Candidate 2 PHP Bug Type: Scripting Engine problem Bug description: regular expression matching goes into almost infinite loop I am using 4.0.0 with Apache 1.3.12 and MySQL, all standard. The following code works fine: $tpattern = ".*<big><b>(.*)</b></big>"; if (eregi($tpattern,$text,$match)) { $title = $match[1]; But adding .* at the end of the pattern, making $tpattern = ".*<big><b>(.*)</b></big>.*"; can take 41 seconds to run, measured using time(). Sometimes it gives the error message Fatal error: Maximum execution time of 30 seconds exceeded in /home/elkan/public_html/crawler.php on line 58

« previous php.dev (#24259) next »