#19970 [Opn->Fbk]: feof()/fgets()/fgetcsv() problem

From: Date: Fri, 18 Oct 2002 08:49:52 +0000
Subject: #19970 [Opn->Fbk]: feof()/fgets()/fgetcsv() problem
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-22746@lists.php.net to get a copy of this message
ID: 19970 Updated by: wez@php.net Reported By: cynic@php.net -Status: Open +Status: Feedback Bug Type: Filesystem function related Operating System: FreeBSD 4.7-STABLE PHP Version: 4.2.2 New Comment: cynic - can you try HEAD or a snapshot from the last day or so? I fixed an eof related issue recently. Previous Comments: ------------------------------------------------------------------------ [2002-10-18 03:45:31] michael.mauch@gmx.de I get bool(true) with 4.2.3 and 4.3.0-dev (from yesterday), both mod_php, Linux 2.4.19. Maybe it's a documentation problem: the manual only says about the return value of fgets(): If an error occurs, returns FALSE. Nothing is said about the return value on EOF (only "People used to the 'C' semantics of fgets() should note the difference in how EOF is returned."), so I guess fgets() is free to return whatever it likes on EOF. Was this different in previous versions of PHP? ------------------------------------------------------------------------ [2002-10-18 01:57:06] cynic@php.net am I the only one who thinks that this should not output anything? <?php $fd = fopen(__FILE__, 'r'); while (!feof($fd)) fgets($fd, 4096) || var_dump(feof($fd)); fclose($fd); I get bool(false) from 4.4.0-dev (cli) and 4.2.2 mod_php. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=19970&edit=1

« previous php.bugs (#22746) next »