Req #46577 [Com]: gzip functions don't read/write mtime header
| From: | cmanley at xs4all dot nl | Date: | Wed, 04 Jan 2023 20:26:55 +0000 |
| Subject: | Req #46577 [Com]: gzip functions don't read/write mtime header | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-243335@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
Comment by: cmanley at xs4all dot nl
Reported by: mmj048 at gmail dot com
Summary: gzip functions don't read/write mtime header
Status: Open
Type: Feature/Change Request
Package: Zlib related
Operating System: Windows Vista
PHP Version: 5.2.6
Block user comment: N
Private report: N
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[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