I last updated a drupal module in late October 2019.

I have Drupal Core 8.8 installed.
I have GDPR 2.0.0. Alpha 7 installed.

When I try to update a module now (Dec 25th ) I get the following message (regardless of the module I want to update):

Quote

bash-3.2$ php -d memory_limit=-1 /usr/local/bin/composer require 'drupal/admin_toolbar:^2.0'
./composer.json has been updated
> DrupalProject\composer\ScriptHandler::checkComposerVersion
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- drupal/gdpr 2.0.0-alpha7 requires ext-zip * -> the requested PHP extension zip is missing from your system.
- drupal/gdpr 2.0.0-alpha7 requires ext-zip * -> the requested PHP extension zip is missing from your system.
- drupal/gdpr 2.0.0-alpha7 requires ext-zip * -> the requested PHP extension zip is missing from your system.
- Installation request for drupal/gdpr (locked at 2.0.0-alpha7, required as ^2.0) -> satisfiable by drupal/gdpr[2.0.0-alpha7].

Installation failed, reverting ./composer.json to its original content.
bash-3.2$

Unquote

Can anyone help - my whole system has become non-updateable!

Many thanks

Andy

Comments

Andy-vv created an issue. See original summary.

Andy-vv’s picture

I manged to solve this by making the alpha-7 version of GDPR explicit in my .json file and also setting the minimum stability requirement as "alpha". There must have been some conflict going on with other dependencies tht was creating an open loop.

philosurfer’s picture

Category: Support request » Bug report
Issue tags: +Composer, +dependencies
philosurfer’s picture

Version: 8.x-2.0-alpha7 » 8.x-2.x-dev

Updated ticket to bug report added tags and changed version to 8.x-2.x-dev as it is happening at the tip of the development branch as well.

philosurfer’s picture

It seems that the issue is appearing for some because macOS Catalina no longer installs this php library locally by default people will get this error when composer installing on their local without it.

Noting: that many would argue running composer locally on your macOS is not a good idea. You should be running it in a VM or container that matches your production environment's stack configuration.

2 things need to be done here:

1) for people compiling composer locally on macOS Catalina, add the library see: Stackexchange topic

2) Update README that reflects the dependency and link out on how to meet the requirement.

philosurfer’s picture

Component: User interface » Documentation
Category: Bug report » Support request
Status: Active » Needs review
StatusFileSize
new949 bytes

To fix the problem on macOS the following worked for me:

- update xCode
- then run the following:

brew update;
brew install php@7.3;
brew link php@7.3 --force;

Note: Use at your own risk as this will now make brew the manager of your PHP executable and could potentially break other PHP applications on your local machine. *not likely, but possible.

attached is a patch to the README.md on the topic.

philosurfer’s picture

Title: GDPR dependencies are blocking hte update of any other drupal module » ext-zip dependency fails composer install for macOS

Additional note, I had to update my *new* php.ini file to increase memory allocation for composer to run properly (previously did this in my native macOS php version as well.

Updated title for people running into the same issue.

james.williams’s picture

How much is the zip extension *really* needed for this project? Perhaps its use could simply be disabled when the extension is not available, and then the dependency could be removed (replaced as a package 'suggestion' instead)?

philosurfer’s picture

Seems to be that GdprTasksSarWorker.php has all the deets!

$> grep -nHR --color --include=\*.{module,php,inc,theme,install,log,json,yml,css} 'zip' ./


... truncated non-relevant lines ... 
.//modules/gdpr_tasks/src/Plugin/QueueWorker/GdprTasksSarWorker.php:21: * and later compile the export files into a single zip archive for download.
.//modules/gdpr_tasks/src/Plugin/QueueWorker/GdprTasksSarWorker.php:202:      if (file_exists("{$directory}/{$uuid}.zip") || file_exists("{$directory}/{$uuid}/")) {
.//modules/gdpr_tasks/src/Plugin/QueueWorker/GdprTasksSarWorker.php:206:      // Generate the zip file to reserve our namespace.
.//modules/gdpr_tasks/src/Plugin/QueueWorker/GdprTasksSarWorker.php:207:      $file = _gdpr_tasks_file_save_data('', $task->getOwner(), "{$directory}/{$uuid}.zip", FILE_EXISTS_ERROR);
.//modules/gdpr_tasks/src/Plugin/QueueWorker/GdprTasksSarWorker.php:265:    $directory .= '/' . basename($field->entity->uri->value, '.zip');
.//modules/gdpr_tasks/src/Plugin/QueueWorker/GdprTasksSarWorker.php:335:   * Compile the SAR into a downloadable zip.
.//modules/gdpr_tasks/src/Plugin/QueueWorker/GdprTasksSarWorker.php:341:    // Compile all files into a single zip.
.//modules/gdpr_tasks/src/Plugin/QueueWorker/GdprTasksSarWorker.php:351:    $zip = new \ZipArchive();
.//modules/gdpr_tasks/src/Plugin/QueueWorker/GdprTasksSarWorker.php:352:    if (!$zip->open($file_path, \ZipArchive::CREATE | \ZipArchive::OVERWRITE)) {
.//modules/gdpr_tasks/src/Plugin/QueueWorker/GdprTasksSarWorker.php:365:      // Add the file to the zip.
.//modules/gdpr_tasks/src/Plugin/QueueWorker/GdprTasksSarWorker.php:367:      $zip->addFile($this->fileSystem->realpath($part_file->uri->value), $part_file->filename->value);
.//modules/gdpr_tasks/src/Plugin/QueueWorker/GdprTasksSarWorker.php:374:      // Add the file to the zip.
.//modules/gdpr_tasks/src/Plugin/QueueWorker/GdprTasksSarWorker.php:377:      $zip->addFile($this->fileSystem->realpath($asset_file->uri->value), $filename);
.//modules/gdpr_tasks/src/Plugin/QueueWorker/GdprTasksSarWorker.php:384:    // Close the zip to write it to disk.
.//modules/gdpr_tasks/src/Plugin/QueueWorker/GdprTasksSarWorker.php:386:    $zip->close();
.//composer.json:20:        "ext-zip": "*",
kevinfunk’s picture

Component: Documentation » Code
Category: Support request » Bug report
StatusFileSize
new3.72 KB

Patch removes the need for ext-zip by using Drupal\Core\Archiver\Zip.

golddragon007’s picture

Status: Needs review » Needs work

The #10 patch doesn't solve anything. Here's why:
1. Drupal\Core\Archiver\Zip using the same library like the original code (ZipArchive) ergo the `ext-zip` is still needed.
2.

+  /**
+   * {@inheritdoc}
+   */
+  public function __construct($file_path) {
+    $this->zip = new \ZipArchive();
+    if ((file_exists($file_path) && $this->zip->open($file_path, \ZipArchive::OVERWRITE) !== TRUE) || $this->zip->open($file_path, \ZipArchive::CREATE) !== TRUE) {
+      throw new ArchiverException(t('Cannot open %file_path', array('%file_path' => $file_path)));
+    }
+  }

Useless, the original constructor code does the same in a much simpler way.

3.

+  /**
+   * {@inheritdoc}
+   */
+  public function add($file_path) {
+    $local_name = basename($file_path);
+    $this->zip->addFile($file_path, $local_name);
+
+    return $this;
+  }

This has two issues:
a/ Useless, the original add() code does the same in a much simpler way (in this form).
b/ Later on this code is fed by two parameters instead of one, and the second parameters is not necessary just the file name as you implemented and totally ignored.

For me on some Linux distributions, it's also wasn't install these composer dependencies. But at least it catching if you missing something.

mhavelant’s picture

As suggested by @james.williams ext-zip should be moved to suggested packages. Additionally, gdpr_tasks should check for this in hook_requirements.

  • mhavelant committed 54e6146 on 8.x-2.x authored by philosurfer
    Issue #3103098 by philosurfer, kevinfunk, Andy-vv, james.williams,...
  • mhavelant committed 92917bf on 8.x-2.x
    Issue #3103098 by philosurfer, kevinfunk, Andy-vv, james.williams,...
mhavelant’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.