[Toolserver-l] protip: i/o and infinite loops in php

Marc A. Pelletier marc at uberbox.org
Wed Jan 23 10:09:26 UTC 2008


River Tarnell wrote:
> never do this:
>
> [...]
>
> while (!feof($f)) {
>   $x .= fgets($f);
> }
>
That may indeed have been a problem with a script of mine; I presumed
libc semantics where if the stream had gotten invalid feof() would
return an error (and, thus, not 0).  At any rate, the script was
experimental and has since been disabled, but it's an important gotcha
to know of.

-- Marc




More information about the Toolserver-l mailing list