Pyh.conf’25: a new PHP conference for the Russian-speaking community

Voting

: min(three, nine)?
(Example: nine)

The Note You're Voting On

waldermort at gmail dot com
8 years ago
Be careful when reading data in a loop. gzread() behaves a little differently than bzread() or fread(), it does NOT return false when reading past the end of stream. It instead returns an empty string.

So a loop like:
$handle = gzopen($file);
while (false !== $chunk = gzread($handle, $bytes)) {
//...
}

will loop indefinitely.

<< Back to user notes page

To Top