#35495 [Asn->Bgs]: feof() does not report EOF on a zero file
| From: | tony2001@php.net | Date: | Thu, 01 Dec 2005 00:07:07 +0000 |
| Subject: | #35495 [Asn->Bgs]: feof() does not report EOF on a zero file | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-89544@lists.php.net to get a copy of this message | ||
ID: 35495
Updated by: tony2001@php.net
Reported By: dsp at tdcspace dot dk
-Status: Assigned
+Status: Bogus
Bug Type: Filesystem function related
Operating System: linux/win
PHP Version: 5CVS, 4CVS (2005-11-30) (snap)
Assigned To: wez
New Comment:
I get the same result with this C code:
#include <stdlib.h>
#include <stdio.h>
int main() {
FILE *fd;
fd = fopen("/tmp/xxx", "r");
while (!feof(fd)) {
char buf[100];
fgets(buf, 100, fd); // remove that and you'll get endless
cycle
printf("read\n");
}
fclose(fd);
return 0;
}
(it reads once and stops just after that)
Doesn't look like a bug to me.
PHP behaves in the same way as the underlying OS.
Previous Comments:
------------------------------------------------------------------------
[2005-11-30 23:43:40] sniper@php.net
Wez, sounds like something isn't working quite well in the streams
world?
------------------------------------------------------------------------
[2005-11-30 22:46:26] dsp at tdcspace dot dk
what i don't understand is that the win/linux lower filesystem layer
maintains a filepointer of which it should be easy to detect/report a
EOF condition. The PHP handle as a file descriptor resource should
among things maintain this.
But i don't maintain php and thus don't know the reasons.
------------------------------------------------------------------------
[2005-11-30 22:40:21] dsp at tdcspace dot dk
nope - 5.1.2.2 cvs - same story - feof() still ignores a zero file
------------------------------------------------------------------------
[2005-11-30 18:42:43] sniper@php.net
No, try the 5.1 snapshot.
------------------------------------------------------------------------
[2005-11-30 18:42:21] dsp at tdcspace dot dk
is there a cvs for 4.4.1
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/35495
--
Edit this bug report at http://bugs.php.net/?id=35495&edit=1