#26752 [Opn->Csd]: fgets can't take variable as buffer length argument

From: Date: Fri, 02 Jan 2004 00:53:57 +0000
Subject: #26752 [Opn->Csd]: fgets can't take variable as buffer length argument
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-52659@lists.php.net to get a copy of this message
ID: 26752 Updated by: iliaa@php.net Reported By: jeroen dot pulles at redslider dot net -Status: Open +Status: Closed Bug Type: Filesystem function related Operating System: Windows 2000 PHP Version: 5.0.0b3 (beta3) New Comment: This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2003-12-31 06:34:39] jeroen dot pulles at redslider dot net The reproduce code (obviously) lacks the $kBufferSize declaration. $kBufferSize = 512; .... or something similar ------------------------------------------------------------------------ [2003-12-31 06:32:16] jeroen dot pulles at redslider dot net Description: ------------ fgets expects a literal for the buffer size argument. It hangs until the max_execution_time timeouts, when you give it a variable. Reproduce code: --------------- $url = 'http://www.google.com/'; if (($handle = fopen($url, 'r')) === false) { die('Couldnt open url '.$url.'.'); } while (feof($handle) === false) { $text = fgets($handle, $kBufferSize); // doesn't work //$text = fgets($handle, 512); // works echo($text); } fclose($handle); Expected result: ---------------- The google homepage (i.e. the given url) Actual result: -------------- Timeout on max_execution_time. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=26752&edit=1

« previous php.bugs (#52659) next »