#20877 [Opn->Bgs]: fgets return 1 char less

From: Date: Sat, 07 Dec 2002 21:03:57 +0000
Subject: #20877 [Opn->Bgs]: fgets return 1 char less
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-26998@lists.php.net to get a copy of this message
ID: 20877 Updated by: iliaa@php.net Reported By: php@5en1.com -Status: Open +Status: Bogus Bug Type: *General Issues Operating System: red hat 7.2 PHP Version: 4.3.0RC2 New Comment: This was actually a bug in the older versions of PHP that has been fixed. If you look at the fgets() documentation you will note that it specifically says: "Returns a string of up to length - 1 bytes read from the file pointed to by fp. Reading ends when length - 1 bytes have been read, on a newline (which is included in the return value), or on EOF (whichever comes first)." Previous Comments: ------------------------------------------------------------------------ [2002-12-07 09:33:13] php@5en1.com Hi when i do a $file=fopen("http://url","r"); $line=fgets($file,2); $line contain only the first char of the file, not 2 this bug wasn't in the php 4.1.1 i have on another server, under which my script work without any problem. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=20877&edit=1

« previous php.bugs (#26998) next »