|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #46577 gzip functions don't read/write mtime header
Submitted: 2008-11-15 11:34 UTC Modified: 2023-01-04 21:22 UTC
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: mmj048 at gmail dot com Assigned:
Status: Duplicate Package: Zlib related
PHP Version: 5.2.6 OS: Windows Vista
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: mmj048 at gmail dot com
New email:
PHP Version: OS:


 [2008-11-15 11:34 UTC] mmj048 at gmail dot com
The gzencode and gzwrite functions, which implement RFC 1952 (, don't read/write the mtime header.
While this is not necessary for gzip compliance ( adding a function to read/write the mtime header when compressing or reading compressed files would be very useful in many cases.

I currently use custom code to read/write the gzip mtime header.


$gzmtime = end(unpack('V', file_get_contents($gzfile, null, null, 4, 4)));


$r = fopen($gzfile, 'r+');
fseek($r, 4);
fwrite($r, pack('V', $filemtime), 4);


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-04-08 18:23 UTC]
-Package: Feature/Change Request +Package: Zlib related
 [2023-01-04 20:26 UTC] cmanley at xs4all dot nl
I've added a feature request related to this here in order to set/read it via stream context options:
 [2023-01-04 21:22 UTC]
-Status: Open +Status: Duplicate
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Oct 04 14:01:25 2023 UTC