From 81b1b0b76592b660aabb21d6060d80110b01f9a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Gris?= Date: Sun, 28 Apr 2024 01:24:57 +0200 Subject: [PATCH] Fix(Task/Ext/Archive/ZipTask): Preseves directories' permissions in zip Fix #1817 Stores directories's original permissions as `ZipArchive::OPSYS_UNIX` `ExternalAttribute`. --- src/Phing/Task/Ext/Archive/ZipTask.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Phing/Task/Ext/Archive/ZipTask.php b/src/Phing/Task/Ext/Archive/ZipTask.php index c1bcddfe5..a43bc98e5 100644 --- a/src/Phing/Task/Ext/Archive/ZipTask.php +++ b/src/Phing/Task/Ext/Archive/ZipTask.php @@ -306,6 +306,9 @@ private function addFilesetsToArchive($zip) if ($f->isDirectory()) { if ($pathInZip != '.') { $zip->addEmptyDir($pathInZip); + $dirAttrName = $pathInZip . '/'; + $dirAttrs = (int) fileperms($f->getPath()) << 16; + $zip->setExternalAttributesName($dirAttrName, \ZipArchive::OPSYS_UNIX, $dirAttrs); } } else { $zip->addFile($f->getAbsolutePath(), $pathInZip);