Make WordPress Core

Opened 9 months ago

Last modified 6 months ago

#58945 new defect (bug)

Issues with downloading and unpacking plugins with PHP 8.2

Reported by: pablo07's profile pablo07 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.2.2
Component: Upgrade/Install Keywords:
Focuses: Cc:

Description

Hello,

I've encountered an issue when trying to download and install plugins or update WordPress on PHP 8.2, both from the admin dashboard and using WP-CLI. This issue does not occur on PHP 8.1.

When attempting to install or update a plugin, the ZIP file is downloaded correctly, but when it comes to unzipping and installing, the process ends with an error of "Could not copy file.". The same issue occurs during a WordPress update.

I conducted a series of tests trying to pinpoint the issue. I carried out tests with both native PHP functions (curl, copy) and WordPress functions (download_url, unzip_file) that are typically used for downloading and installing plugins and updates.

Moreover, I noticed that the issue also arises when trying to update to a previous version via WP-CLI. In this case, after the ZIP file is downloaded, unzipped, and attempted to install, an error of "Warning: Could not copy file." is produced.

Here seems to be a WP-CLI cache clearing issue as empty zip files remain

Given the above, I suspect that the problem might be due to some incompatibility between PHP 8.2 and the WordPress functions used for downloading and installing plugins and updates.

Could someone take a look at this issue? Any help would be greatly appreciated.

:~/public_html$ wp plugin update classic-editor
Downloading update from https://downloads.wordpress.org/plugin/classic-editor.1.6.3.zip...
Unpacking the update...
Installing the latest version...
Removing the old version of the plugin...
Plugin updated successfully.
+----------------+-------------+-------------+---------+
| name           | old_version | new_version | status  |
+----------------+-------------+-------------+---------+
| classic-editor | 1.6.1       | 1.6.3       | Updated |
+----------------+-------------+-------------+---------+
Success: Updated 1 of 1 plugins.

:~/public_html$ wp plugin update classic-editor --version=1.6.1
Installing Classic Editor (1.6.1)
Downloading installation package from https://downloads.wordpress.org/plugin/classic-editor.1.6.1.zip...
Unpacking the package...
Installing the plugin...
Removing the old version of the plugin...
Plugin updated successfully.
Success: Installed 1 of 1 plugins.

:~/public_html$ wp plugin update classic-editor
Downloading update from https://downloads.wordpress.org/plugin/classic-editor.1.6.3.zip...
Using cached file '/home/***/.wp-cli/cache/plugin/classic-editor-1.6.3.zip'...
Error: Error copying cached file /home/***/.wp-cli/cache/plugin/classic-editor-1.6.3.zip to https://downloads.wordpress.org/plugin/classic-editor.1.6.3.zip


:~/.wp-cli/cache/plugin$ ls -l
total 0
-rw-r--r-- 1 *** *** 0 Jul 31 10:40 classic-editor-1.6.1.zip
-rw-r--r-- 1 *** *** 0 Jul 31 10:40 classic-editor-1.6.3.zip

Change History (3)

#1 @afragen
9 months ago

I could not replicate and this using PHP 8.2.8 in Local app.

Setting Local environment variables...
----
WP-CLI:   WP-CLI 2.8.1
Deprecation Notice: Using ${var} in strings is deprecated, use {$var} instead in phar:///Applications/Local.app/Contents/Resources/extraResources/bin/composer/composer.phar/src/Composer/Autoload/AutoloadGenerator.php:799
Deprecation Notice: Using ${var} in strings is deprecated, use {$var} instead in phar:///Applications/Local.app/Contents/Resources/extraResources/bin/composer/composer.phar/src/Composer/Autoload/AutoloadGenerator.php:804
Composer: 2.1.5 2021-07-23
PHP:      8.2.8
MySQL:    mysql  Ver 8.0.16 for macos10.14 on x86_64 (MySQL Community Server - GPL)
----
Launching shell: /bin/zsh ...
➜  AJF-M1-MBA arm64: ~/Local_Sites/lightning/app/public wp plugin install classic-editor --version=1.6.1
Installing Classic Editor (1.6.1)
Downloading installation package from https://downloads.wordpress.org/plugin/classic-editor.1.6.1.zip...
The authenticity of classic-editor.1.6.1.zip could not be verified as no signature was found.
Unpacking the package...
Installing the plugin...
Plugin installed successfully.
Success: Installed 1 of 1 plugins.
➜  AJF-M1-MBA arm64: ~/Local_Sites/lightning/app/public wp plugin update classic-editor
Downloading update from https://downloads.wordpress.org/plugin/classic-editor.1.6.3.zip...
Using cached file '/Users/afragen/.wp-cli/cache/plugin/classic-editor-1.6.3.zip'...
The authenticity of classic-editor.1.6.3.zip could not be verified as no signature was found.
Unpacking the update...
Installing the latest version...
Removing the old version of the plugin...
Plugin updated successfully.
+----------------+-------------+-------------+---------+
| name           | old_version | new_version | status  |
+----------------+-------------+-------------+---------+
| classic-editor | 1.6.1       | 1.6.3       | Updated |
+----------------+-------------+-------------+---------+
Success: Updated 1 of 1 plugins.
➜  AJF-M1-MBA arm64: ~/Local_Sites/lightning/app/public wp plugin update classic-editor --version=1.6.1
Installing Classic Editor (1.6.1)
Downloading installation package from https://downloads.wordpress.org/plugin/classic-editor.1.6.1.zip...
Using cached file '/Users/afragen/.wp-cli/cache/plugin/classic-editor-1.6.1.zip'...
The authenticity of classic-editor.1.6.1.zip could not be verified as no signature was found.
Unpacking the package...
Installing the plugin...
Removing the old version of the plugin...
Plugin updated successfully.
Success: Installed 1 of 1 plugins.
➜  AJF-M1-MBA arm64: ~/Local_Sites/lightning/app/public wp plugin update classic-editor
Downloading update from https://downloads.wordpress.org/plugin/classic-editor.1.6.3.zip...
Using cached file '/Users/afragen/.wp-cli/cache/plugin/classic-editor-1.6.3.zip'...
The authenticity of classic-editor.1.6.3.zip could not be verified as no signature was found.
Unpacking the update...
Installing the latest version...
Removing the old version of the plugin...
Plugin updated successfully.
+----------------+-------------+-------------+---------+
| name           | old_version | new_version | status  |
+----------------+-------------+-------------+---------+
| classic-editor | 1.6.1       | 1.6.3       | Updated |
+----------------+-------------+-------------+---------+
Success: Updated 1 of 1 plugins.

This ticket was mentioned in Slack in #core-upgrade-install by pbiron. View the logs.


8 months ago

#3 @pablo07
6 months ago

I have not been able to reproduce this issue in a local environment, however, I've noticed that it only occurs when utilizing the WordPress update function. I've tried various approaches to pinpoint the problem within PHP to no avail. If anyone has suggestions or needs further information to help resolve this issue, feel free to reach out.

Note: See TracTickets for help on using tickets.