Req #46577 [Opn->Dup]: gzip functions don't read/write mtime header
| From: | requinix@php.net | Date: | Wed, 04 Jan 2023 21:22:00 +0000 |
| Subject: | Req #46577 [Opn->Dup]: gzip functions don't read/write mtime header | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-243336@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=46577&edit=1
ID: 46577
Updated by: requinix@php.net
Reported by: mmj048 at gmail dot com
Summary: gzip functions don't read/write mtime header
-Status: Open
+Status: Duplicate
Type: Feature/Change Request
Package: Zlib related
Operating System: Windows Vista
PHP Version: 5.2.6
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2023-01-04 20:26:55] 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:
https://github.com/php/php-src/issues/10222
------------------------------------------------------------------------
[2008-11-15 11:34:01] mmj048 at gmail dot com
Description:
------------
The gzencode and gzwrite functions, which implement RFC 1952
(http://www.gzip.org/zlib/rfc-gzip.html), don't read/write the mtime header.
While this is not necessary for gzip compliance
(http://www.gzip.org/zlib/rfc-gzip.html#id-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.
Read:
$gzmtime = end(unpack('V', file_get_contents($gzfile, null, null, 4, 4)));
Write:
$r = fopen($gzfile, 'r+');
fseek($r, 4);
fwrite($r, pack('V', $filemtime), 4);
fclose($r);
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=46577&edit=1