summaryrefslogtreecommitdiff
path: root/ext/zip/php_zip.c
diff options
context:
space:
mode:
authorRemi Collet <remi@php.net>2020-03-09 07:09:50 +0100
committerRemi Collet <remi@php.net>2020-03-09 07:09:50 +0100
commited998f8a0dc727be21b3a4b10841c10dbafe5e6d (patch)
tree8a188c9f18b7a73a54c8cb1f45783419998200ac /ext/zip/php_zip.c
parent373a6d82749baf7681127a696374bc0effded5cb (diff)
downloadphp-git-ed998f8a0dc727be21b3a4b10841c10dbafe5e6d.tar.gz
Fix #50678 files extracted by ZipArchive class lost their original modified time
Diffstat (limited to 'ext/zip/php_zip.c')
-rw-r--r--ext/zip/php_zip.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c
index 8986279602..e7ca9cb477 100644
--- a/ext/zip/php_zip.c
+++ b/ext/zip/php_zip.c
@@ -258,6 +258,13 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, size_t
php_stream_write(stream, b, n);
}
+ if (stream->wrapper->wops->stream_metadata) {
+ struct utimbuf ut;
+
+ ut.modtime = ut.actime = sb.mtime;
+ stream->wrapper->wops->stream_metadata(stream->wrapper, fullpath, PHP_STREAM_META_TOUCH, &ut, NULL);
+ }
+
php_stream_close(stream);
n = zip_fclose(zf);