From 7715163310c518d69cd0d9c63d0b4ea79e0c0366 Mon Sep 17 00:00:00 2001 From: Dave Long Date: Thu, 17 Nov 2022 17:32:15 +0000 Subject: [PATCH] Issue #3163123 by Spokje, anmolgoyal74, andypost, guilhermevp, Niklan, Hardik_Patel_12, quietone, larowlan: Error: Class 'ZipArchive' not found in Drupal\Core\Archiver\Zip->__construct() (line 30 of core/lib/Drupal/Core/Archiver/Zip.php) --- composer.lock | 5 ++++- core/composer.json | 3 +++ core/modules/system/system.module | 10 ++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/composer.lock b/composer.lock index 8693d7f2da4..5815ea8a3e5 100644 --- a/composer.lock +++ b/composer.lock @@ -443,7 +443,7 @@ "dist": { "type": "path", "url": "core", - "reference": "938187e9cd9745789a97efca65f1515cd4aed57f" + "reference": "7f3a4442b8f97a22b50998a09c3d0d0a56725fc0" }, "require": { "asm89/stack-cors": "^2.1", @@ -514,6 +514,9 @@ "drupal/core-uuid": "self.version", "drupal/core-version": "self.version" }, + "suggest": { + "ext-zip": "Needed to extend the plugin.manager.archiver service capability with the handling of files in the ZIP format." + }, "type": "drupal-core", "extra": { "drupal-scaffold": { diff --git a/core/composer.json b/core/composer.json index ffd41d501a6..621fe433634 100644 --- a/core/composer.json +++ b/core/composer.json @@ -109,6 +109,9 @@ "config": { "preferred-install": "dist" }, + "suggest": { + "ext-zip": "Needed to extend the plugin.manager.archiver service capability with the handling of files in the ZIP format." + }, "extra": { "drupal-scaffold": { "file-mapping": { diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 47b8324ce53..6cadc541b9a 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -1389,3 +1389,13 @@ function system_file_download($uri) { } } } + +/** + * Implements hook_archiver_info_alter(). + */ +function system_archiver_info_alter(&$info) { + if (!class_exists(\ZipArchive::class)) { + // PHP Zip extension is missing. + unset($info['Zip']); + } +}