|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[1999-12-10 13:49 UTC] nickl at mycomputer dot com
[1999-12-28 21:40 UTC] sas at cvs dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Thu Jul 09 11:00:01 2026 UTC |
If 'tmp' is a file that is exactly 25 bytes long, then: $fd = fopen('tmp', 'r'); echo "fpos: " . ftell($fd) . " eof: " . feof($fd) . "\n"; fread($fd, 25); echo "fpos: " . ftell($fd) . " eof: " . feof($fd) . "\n"; fread($fd, 1); echo "fpos: " . ftell($fd) . " eof: " . feof($fd) . "\n"; results: fpos: 0 eof?: fpos: 25 eof?: fpos: 25 eof?: 1 This caused one of my scripts to crash since even though the next fread() didn't die, passing the null it returned on to an unpack() did. My current work-around is rather than to use: while (feof($fd)) {} I do: $size = filesize($file); while (ftell($fd) < $size) {} However, this obviously won't work on streams that don't come from the local filesystem. My setup is: (from config.status) ./configure --with-mysql=/usr/local/mysql --enable-track-vars --enable-sysvsem --enable-sysvshm --with-gdchart=/usr/local/src/gdchart0.94b --with-gd=/usr/local/src/gd1.5 --prefix=/usr/local --with-ttf --enable-magic-quotes --with-apache=/usr/local/apache Actually, this isn't exactly correct - I also compile the CGI version - for which I remove the apache stuff... and in fact it's the CGI version that I was using when I noticed the problem.