|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-06-04 15:50 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 19:00:01 2025 UTC |
Description: ------------ fgets calls will keep returning false if a fd has at some point reached end-of-file, even though the pointer is no longer at EOF. feof() will also keep returning true. Using fread() instead of fgets() works, but is inconvenient if you'd like to read just one line at a time. Reproduce code: --------------- $fdw = fopen("test", "w"); $fdr = fopen("test", "r"); fputs($fdw, "testing 1..\n"); var_dump(fgets($fdr, 0xff)); var_dump(fgets($fdr, 0xff)); fputs($fdw, "testing 2..\n"); var_dump(fgets($fdr, 0xff)); Expected result: ---------------- string(12) "testing 1.. " bool(false) string(12) "testing 2.. " Actual result: -------------- string(12) "testing 1.. " bool(false) bool(false)