#42014 [Opn]: gzgets returns false when reading an uncompressed file

From: Date: Tue, 12 Aug 2008 17:05:45 +0000
Subject: #42014 [Opn]: gzgets returns false when reading an uncompressed file
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-1092@lists.php.net to get a copy of this message
 ID:               42014
 Updated by:       jani@php.net
 Reported By:      dustin at virtualroadside dot com
 Status:           Open
-Bug Type:         Streams related
+Bug Type:         Documentation problem
 Operating System: Gentoo Linux
-PHP Version:      5.2.3
+PHP Version:      5.2.x
 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------

[2007-07-17 02:05:18] 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.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=42014&edit=1



Thread (3 messages)

« previous php.doc.bugs (#1092) next »