Bug #50678 [Asn->Csd]: files extracted by ZipArchive class lost their original modified time
| From: | remi@php.net | Date: | Mon, 09 Mar 2020 06:09:55 +0000 |
| Subject: | Bug #50678 [Asn->Csd]: files extracted by ZipArchive class lost their original modified time | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-225960@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=50678&edit=1
ID: 50678
Updated by: remi@php.net
Reported by: sunchaojun at gmail dot com
Summary: files extracted by ZipArchive class lost their
original modified time
-Status: Assigned
+Status: Closed
Type: Bug
Package: Zip Related
Operating System: windows
PHP Version: 5.6.9
Assigned To: remi
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of remi
Revision: http://git.php.net/?p=php-src.git;a=commit;h=ed998f8a0dc727be21b3a4b10841c10dbafe5e6d
Log: Fix #50678 files extracted by ZipArchive class lost their original modified time
Previous Comments:
------------------------------------------------------------------------
[2020-03-06 14:10:05] remi@php.net
The following pull request has been associated:
Patch Name: Fix #50678 files extracted by ZipArchive class lost their original moâ¦
On GitHub: https://github.com/php/php-src/pull/5244
Patch: https://github.com/php/php-src/pull/5244.patch
------------------------------------------------------------------------
[2015-05-20 22:41:54] cmb@php.net
I have to correct myself. According to the PKWARE ZIP file format
specification [1], the only timestamp that is generally available
for files in an archive is the mtime. ctime and atime are only
supported for some host systems and available in extra fields,
which don't seem to be supported by libzip[2] at all.
To set the stored mtime when files are extracted, it seems to be
sufficient to retrieve it via zip_stat_index() and to touch the
files after extraction in php_zip_extract_file().
[1] <https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT>
[2] <http://www.nih.at/libzip/zip_stat.html>
------------------------------------------------------------------------
[2015-05-20 19:07:12] cmb@php.net
Verified for PHP 5.6.9.
> AFAIK last access and creation time is not stored in a zip file,
> [...]
The creation time can be stored in a ZIP file, but ZipArchive
doesn't do that.
------------------------------------------------------------------------
[2014-08-06 11:40:13] michaeld at owl-online dot de
sadly, it is still in there: php 5.5.11 win and php 5.3.4 linux
------------------------------------------------------------------------
[2010-06-15 22:32:02] hardcorevenom at gmx dot de
Server:
PHP Version 5.2.13
Apache/2.2.3 (Scientific Linux)
ZipArchive::extractTo("dir") sets the dates of all extracted files to the current time.
The original "mdate" stored in the zip archive is not restored as expected.
AFAIK last access and creation time is not stored in a zip file, only last modified. So access and
creation time is currently set correctly.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=50678
--
Edit this bug report at https://bugs.php.net/bug.php?id=50678&edit=1