1
0
Fork 0

Merge pull request #8331 from jimmy-ho/bug/issue-8330

8330 Correct issue where permission umask of files were not set when …
pull/8538/head
Jordi Boggiano 2020-01-14 15:09:28 +01:00 committed by GitHub
commit c3d3d45903
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions

View File

@ -45,6 +45,18 @@ class ZipArchiver implements ArchiverInterface
} else {
$zip->addFile($filepath, $localname);
}
/**
* ZipArchive::setExternalAttributesName is available from >= PHP 5.6
*/
if (PHP_VERSION_ID >= 50600) {
$perms = fileperms($filepath);
/**
* Ensure to preserve the permission umasks for the filepath in the archive.
*/
$zip->setExternalAttributesName($localname, ZipArchive::OPSYS_UNIX, $perms << 16);
}
}
if ($zip->close()) {
return $target;