|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #44893 gzfile() does not load complete GIF file
Submitted: 2008-05-02 16:31 UTC Modified: 2020-09-22 14:54 UTC
From: sworddragon2 at aol dot com Assigned: cmb (profile)
Status: Closed Package: Zlib related
PHP Version: 5CVS, 6CVS (2008-10-30) OS: Windows XP Professional SP3
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: sworddragon2 at aol dot com
New email:
PHP Version: OS:


 [2008-05-02 16:31 UTC] sworddragon2 at aol dot com
If im trying to use the function gzfile() to a compressed file, that
includes just a picture, the function don't read the complete file. On
this reproduce, the function stops after the End Transmission Block.

Reproduce code:

Expected result:
I expect to see all arrays until the end of the file.

Actual result:
With gzfile, i got just the array [0] with the content GIF89a


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-05-02 20:49 UTC]
Couldn't reproduce on Win XP SP2 with
 [2008-05-02 21:19 UTC] sworddragon2 at aol dot com
I used this picture for the example:

Maybe it helps you to reproduce the problem. But this was not the only picture with that I can reproduce the problem.
 [2008-05-06 11:08 UTC]
Im able to re-produce this on Windows XP SP2 using the image you supplied aswell as with other files would return odd strings
 [2008-10-29 17:29 UTC] sworddragon2 at aol dot com
I tested it with the 5.2.7RC2-dev and the 5.3.0alpha3-dev from your link, but the bug isn't fixed. In both versions, Firefox 3.0.3 gives me an output of:

    [0] => GIF89a

It breaks again after the End Transmission Block. I used the same picture again.
 [2008-10-30 17:14 UTC]
What actually is the bug here? You're concatenating same image in same file and expect..what?
 [2008-10-30 17:15 UTC]

I think that should also be "wb" under windows..
 [2008-11-02 23:13 UTC] sworddragon2 at aol dot com
I tried it with wb, but it doesn't help.

The problem is, that gzfile stops the read process after 7/132 byte. The read process is breaking after gzfile reads the ETB (End Transmission Block), which is the seventh char of this picture.
 [2008-11-21 17:57 UTC]
gzfile() is not binary-safe. So the behaviour here isn't really unexpected. Anyway, you're better of using gzread() instead when dealing with binary files.
 [2011-04-08 20:55 UTC]
-Package: Feature/Change Request +Package: Zlib related
 [2020-09-22 14:54 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2020-09-22 14:54 UTC]
gzfile() is for reading compressed *text* files.  However, GIF
files are no text files.  This feature request doesn't make any
sense to me.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Jun 19 23:01:29 2024 UTC