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

From: Date: Mon, 10 Nov 2008 11:22:21 +0000
Subject: #42014 [Opn->Bgs]: gzgets returns false when reading an uncompressed file
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-1474@lists.php.net to get a copy of this message
ID: 42014 Updated by: vrana@php.net Reported By: dustin at virtualroadside dot com -Status: Open +Status: Bogus Bug Type: Documentation problem Operating System: Gentoo Linux PHP Version: 5.2.x New Comment: It is documented that gzgets() returns FALSE on error. And working with uncompressed file by compression function is an error for sure. Previous Comments: ------------------------------------------------------------------------ [2008-08-12 17:07:44] jani@php.net I meant: "gzgets() and friends are actually just aliases.." ie. not wrappers. :) ------------------------------------------------------------------------ [2008-08-12 17:05:39] 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. ------------------------------------------------------------------------ [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

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