[Hastymail-devel] reading loop
Brought to you by:
sailfrog,
slushpupie
From: Thierry de M. <th...@if...> - 2010-09-15 12:38:08
|
Hi, We are getting a lot of those when our site gets busy: > [Wed Sep 15 14:09:19 2010] [error] [client 168.172.253.253] PHP Fatal error: Maximum execution time of 30 seconds exceeded in /var/www/html/test/hastymail2-1.0/lib/imap_class.php on line 175, referer: ... It looks like if the socket times out, the loop just goes endless. I added a little check for the return code of fgets(), and it looks to fix the problem. Please see patch below. Regards, Thierry ________________________________ Thierry de Montaudry Interface Holding (Pty) Ltd +27 (0)82 812 6622 +27 (0)11 628 9800 ======== BEGIN CODE ======== --- lib/imap_class.php (revision 129) +++ lib/imap_class.php (working copy) @@ -173,6 +173,9 @@ break; } $result[$n] .= fgets($this->handle, $line_length); + if($result[$n]===false) { + break; + } $current_size += strlen($result[$n]); if ($max && $current_size > $max) { $this->max_read = true; ======== END CODE ======== |