From e01235fc08869cfca9ee8c4028ea69763e121bef Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 6 Mar 2020 11:16:20 +0100 Subject: [PATCH 1/5] Add test for bug #63816 This has been fixed in PHP 7.4, add a test for it. --- Zend/tests/bug63816.phpt | 45 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 Zend/tests/bug63816.phpt diff --git a/Zend/tests/bug63816.phpt b/Zend/tests/bug63816.phpt new file mode 100644 index 0000000000000..b6db9bd1dabb6 --- /dev/null +++ b/Zend/tests/bug63816.phpt @@ -0,0 +1,45 @@ +--TEST-- +Bug #63816: implementation child interface and after parent cause fatal error +--FILE-- + +===DONE=== +--EXPECT-- +===DONE=== From 24d6861bda187798915047db63bddb1015749b2f Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 6 Mar 2020 10:54:16 +0100 Subject: [PATCH 2/5] Fix community job Marco broke things again. --- azure/community_job.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure/community_job.yml b/azure/community_job.yml index 04c8df224d06f..19d43ef651a9f 100644 --- a/azure/community_job.yml +++ b/azure/community_job.yml @@ -80,7 +80,7 @@ jobs: - script: | git clone https://github.com/amphp/amp.git --branch=master --depth=1 cd amp - php7.3 /usr/bin/composer install --no-progress --ignore-platform-reqs + php /usr/bin/composer install --no-progress --ignore-platform-reqs export USE_ZEND_ALLOC=0 sed -i 's/$exit = true/$exit = false/g' vendor/phpunit/phpunit/src/TextUI/Command.php php vendor/bin/phpunit From ad9665a9145745c8b7b967f1691aadc746bd9281 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 6 Mar 2020 15:08:10 +0100 Subject: [PATCH 3/5] Fix #50678 files extracted by ZipArchive class lost their original modified time --- ext/zip/php_zip.c | 7 +++++++ ext/zip/tests/bug50678.phpt | 29 +++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 ext/zip/tests/bug50678.phpt diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index 898627960242a..e7ca9cb4775a0 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); diff --git a/ext/zip/tests/bug50678.phpt b/ext/zip/tests/bug50678.phpt new file mode 100644 index 0000000000000..7734f9336dfcc --- /dev/null +++ b/ext/zip/tests/bug50678.phpt @@ -0,0 +1,29 @@ +--TEST-- +Bug #50678 (files extracted by ZipArchive class lost their original modified time) +--SKIPIF-- + +--FILE-- +open($filename); +$zip->extractTo($dirname); +$zip->close(); + +var_dump(date('Ymd', filemtime($dirname . '/entry1.txt'))); +?> +Done +--EXPECT-- +string(8) "20060706" +Done +--CLEAN-- + From fb1b70ac6948abc905a9bd4a2317340c6d66f331 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 6 Mar 2020 20:35:55 +0100 Subject: [PATCH 4/5] better test --- ext/zip/tests/bug50678.phpt | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/ext/zip/tests/bug50678.phpt b/ext/zip/tests/bug50678.phpt index 7734f9336dfcc..d6fa736b36c23 100644 --- a/ext/zip/tests/bug50678.phpt +++ b/ext/zip/tests/bug50678.phpt @@ -1,26 +1,34 @@ --TEST-- -Bug #50678 (files extracted by ZipArchive class lost their original modified time) +Bug #50678 files extracted by ZipArchive class lost their original modified time --SKIPIF-- --FILE-- open($filename); +$zip->open($zipname, ZipArchive::CREATE | ZipArchive::OVERWRITE); +$zip->addFile($file, 'foo'); +$zip->close(); + +// Extract it +$zip->open($zipname); $zip->extractTo($dirname); $zip->close(); -var_dump(date('Ymd', filemtime($dirname . '/entry1.txt'))); +// Time is preserved +var_dump(filemtime($file) == filemtime($dirname . '/foo')); ?> Done --EXPECT-- -string(8) "20060706" +bool(true) Done --CLEAN-- Date: Fri, 6 Mar 2020 20:54:48 +0100 Subject: [PATCH 5/5] Revert "better test" This reverts commit fb1b70ac6948abc905a9bd4a2317340c6d66f331. --- ext/zip/tests/bug50678.phpt | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/ext/zip/tests/bug50678.phpt b/ext/zip/tests/bug50678.phpt index d6fa736b36c23..7734f9336dfcc 100644 --- a/ext/zip/tests/bug50678.phpt +++ b/ext/zip/tests/bug50678.phpt @@ -1,34 +1,26 @@ --TEST-- -Bug #50678 files extracted by ZipArchive class lost their original modified time +Bug #50678 (files extracted by ZipArchive class lost their original modified time) --SKIPIF-- --FILE-- open($zipname, ZipArchive::CREATE | ZipArchive::OVERWRITE); -$zip->addFile($file, 'foo'); -$zip->close(); - -// Extract it -$zip->open($zipname); +$zip->open($filename); $zip->extractTo($dirname); $zip->close(); -// Time is preserved -var_dump(filemtime($file) == filemtime($dirname . '/foo')); +var_dump(date('Ymd', filemtime($dirname . '/entry1.txt'))); ?> Done --EXPECT-- -bool(true) +string(8) "20060706" Done --CLEAN--