Re: preg_match bug

From: Date: Tue, 26 Aug 2003 11:02:40 +0000
Subject: Re: preg_match bug
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-160788@lists.php.net to get a copy of this message
Certainly. It crashes out when attempting to parse large files. My resource limits are set to 20m in the php.ini file, so thats not the issue. <?php //require_once ("Application.php"); // constants $FILE = "alargefile.html"; // open file $resource = fopen ("$FILE", "r"); // read file into buffer $fileBuffer = fread ($resource, filesize ($FILE)); // match all table rows $reg = "%<tr(.|\n)*?>(.|\n)+?</tr>%"; $matches = array(); // output number of matches echo preg_match_all($reg, $fileBuffer, $matches); ?> "Curt Zirzow" <php-general@zirzow.dyndns.org> wrote in message news:20030826020135.GZ56835@bagend.shire... > * Thus wrote Christian Calloway (callowaylc@yahoo.com): > > Hey I wanted to see if anyone was getting the same problem. Using preg_match > > in the following pattern: > > > > "/<tr bgcolor="#FFFFFF">(.|\n)+?<\/tr>/" > > > > PHP seems to be crashing. I get a "Page cannot be displayed" message from > > the browser. I've come across this before, and I just upgraded to 4.3.3, and > > no difference. > > An error from the browser doesn't exactly prove that php is > 'Crashing'. Please look in the system logs for the crash. > > Also, in order to be able to reproduce this a small snipplet of > code that can reproduce the 'crash' would be exrememly helpful. > > > Curt > -- > "I used to think I was indecisive, but now I'm not so sure."

« previous php.general (#160788) next »