#26752 [NEW]: fgets can't take variable as buffer length argument
| From: | jeroen dot pulles at redslider dot net | Date: | Wed, 31 Dec 2003 11:32:17 +0000 |
| Subject: | #26752 [NEW]: fgets can't take variable as buffer length argument | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-52633@lists.php.net to get a copy of this message | ||
From: jeroen dot pulles at redslider dot net
Operating system: Windows 2000
PHP version: 5.0.0b3 (beta3)
PHP Bug Type: Filesystem function related
Bug description: fgets can't take variable as buffer length argument
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 bug report at http://bugs.php.net/?id=26752&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26752&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26752&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=26752&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=26752&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=26752&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=26752&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=26752&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=26752&r=support
Expected behavior: http://bugs.php.net/fix.php?id=26752&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=26752&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=26752&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=26752&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26752&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=26752&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=26752&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=26752&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26752&r=float