php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #42014 gzgets returns false when reading an uncompressed file
Submitted: 2007-07-17 02:05 UTC Modified: 2008-11-10 11:22 UTC
From: dustin at virtualroadside dot com Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: 5.2.x OS: Gentoo Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: dustin at virtualroadside dot com
New email:
PHP Version: OS:

 

 [2007-07-17 02:05 UTC] dustin at virtualroadside dot com
Description:
------------
gzgets returns false at the end of file when reading an uncompressed file. It does not return false when reading compressed files.

Installed:
zlib 1.2.3-r1 (gentoo)


If this is intended behavior, then the documentation should probably have it in there.. unless I missed it. :)

Reproduce code:
---------------
$f = gzopen('somefile','r');

while(!gzeof($f))
        if (($line = gzgets($f,65535)) === false)
                echo "It returned false.\n";
        else
                echo "It did not return false!\n";


Expected result:
----------------
It did not return false!

... 

It did not return false!

Actual result:
--------------
It did not return false!

... 

It did not return false!
It returned false.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-08-12 17:05 UTC] jani@php.net
Since gzgets() is actually just a wrapper for fgets(), just using zlib fopen wrapper, it behaves (expectectly) like fgets() does. No bug, just documentation issue.
 [2008-08-12 17:07 UTC] jani@php.net
I meant: "gzgets() and friends are actually just aliases.." ie. not wrappers. :)
 [2008-11-10 11:22 UTC] vrana@php.net
It is documented that gzgets() returns FALSE on error. And working with uncompressed file by compression function is an error for sure.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Nov 30 04:00:01 2025 UTC