diff --git a/src/Phing/Task/Ext/Archive/ZipTask.php b/src/Phing/Task/Ext/Archive/ZipTask.php index 3e1749a19..9a7c5e012 100644 --- a/src/Phing/Task/Ext/Archive/ZipTask.php +++ b/src/Phing/Task/Ext/Archive/ZipTask.php @@ -88,7 +88,9 @@ private static function fixDirAttributes($zip, $f, $pathInZip) { $indexInZip = $zip->locateName('/' === mb_substr($pathInZip, -1) ? $pathInZip : $pathInZip . '/'); if (false !== $indexInZip) { - $zip->setMtimeIndex($indexInZip, $f->lastModified()); + if (method_exists($zip, 'setMtimeIndex')) { // PHP >= 8.0.0, PECL zip >= 1.16.0 + $zip->setMtimeIndex($indexInZip, $f->lastModified()); + } $filePerms = fileperms($f->getPath()); if (false !== $filePerms) { // filePerms supported $zip->setExternalAttributesIndex($indexInZip, \ZipArchive::OPSYS_DEFAULT, $filePerms << 16);