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

From: Date: Wed, 12 Jul 2000 06:37:34 +0000
Subject: Re: PHP 4.0 Bug #5545: regular expression matching goes into almost infinite loop
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-24263@lists.php.net to get a copy of this message
How big is $text? Try preg_match() instead. -Rasmus On 13 Jul 2000 elkan@cs.ucsd.edu wrote: > 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 (#24263) next »