extension-command icon indicating copy to clipboard operation
extension-command copied to clipboard

Unable to install plugin by plugin directory URL

Open lordspace opened this issue 10 months ago • 4 comments

Bug Report

Describe the current, buggy behavior plugin install fails with ZIP error. php 8.3 and php 8.4

A clear and concise description of the behavior that produces a wrong result or error. PCLZIP_ERR_BAD_FORMAT (-10) : Unable to find End of Central Dir Record signature

Remember to provide some context to make sure we're all on the same page when reasoning about this.

Describe how other contributors can replicate this bug

wp plugin install --path='/path/htdocs' --skip-themes --skip-packages --activate 'https://wordpress.org/plugins/orbisius-seo-editor/'

Describe what you would expect as the correct outcome a plugin to be installed and activated. It used to work.

Downloading installation package from https://wordpress.org/plugins/orbisius-seo-editor/...
Unpacking the package...
Warning: The package could not be installed. "PCLZIP_ERR_BAD_FORMAT (-10) : Unable to find End of Central Dir Record signature"
Warning: The 'https://wordpress.org/plugins/orbisius-seo-editor/' plugin could not be found.
Error: No plugins installed.
Exit Status: 1 exit status 1

Let us know what environment you are running this on

(Paste the output of "wp cli info" into this box)
I have a tool that switches to a given user. Just sets uid and runs wp-cli
owp cli info
OS:	Linux 6.8.0-59-generic #61~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Apr 15 17:03:15 UTC 2 x86_64
Shell:	/bin/bash
PHP binary:	/usr/bin/php8.4
PHP version:	8.4.6
php.ini used:	/etc/php/8.4/cli/php.ini
MySQL binary:	/usr/bin/mariadb
MySQL version:	mariadb  Ver 15.1 Distrib 10.6.21-MariaDB, for debian-linux-gnu (x86_64) using  EditLine wrapper
SQL modes:	
WP-CLI root dir:	phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:	phar://wp-cli.phar/vendor
WP_CLI phar path:	phar:///usr/local/bin/wp
WP-CLI packages dir:	
WP-CLI cache dir:	/root/.wp-cli/cache
WP-CLI global config:	
WP-CLI project config:	
WP-CLI version:	2.12.0


also fails on a server with
OS:     Linux 5.4.0-193-generic #213-Ubuntu SMP Fri Aug 2 19:14:16 UTC 2024 x86_64
Shell:  /bin/bash
PHP binary:     /usr/bin/php8.3
PHP version:    8.3.11
php.ini used:   /etc/php/8.3/cli/php.ini
MySQL binary:   /usr/bin/mariadb
MySQL version:  mariadb  Ver 15.1 Distrib 10.3.39-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
SQL modes:
WP-CLI root dir:        phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:      phar://wp-cli.phar/vendor
WP_CLI phar path:       phar:///usr/local/bin/wp
WP-CLI packages dir:
WP-CLI cache dir:       /dev/null
WP-CLI global config:   
WP-CLI project config:  
WP-CLI version: 2.12.0


Provide a possible solution maybe the issue is with wp org not providing a zip file OR wp-cli can't download the file or it gets broken during transfer ?

full debug

Debug (bootstrap): Processing bootstrap step: WP_CLI\Bootstrap\DeclareAbstractBaseCommand (0.008s)
Debug (bootstrap): Processing bootstrap step: WP_CLI\Bootstrap\IncludeFrameworkAutoloader (0.009s)
Debug (bootstrap): Processing bootstrap step: WP_CLI\Bootstrap\ConfigureRunner (0.009s)
Debug (bootstrap): Processing bootstrap step: WP_CLI\Bootstrap\InitializeColorization (0.009s)
Debug (bootstrap): Processing bootstrap step: WP_CLI\Bootstrap\InitializeLogger (0.009s)
Debug (bootstrap): Processing bootstrap step: WP_CLI\Bootstrap\CheckRoot (0.009s)
Debug (bootstrap): Processing bootstrap step: WP_CLI\Bootstrap\IncludeRequestsAutoloader (0.009s)
Debug (bootstrap): Setting RequestsLibrary::$version to v2 (0.009s)
Debug (bootstrap): Setting RequestsLibrary::$source to wp-core (0.009s)
Debug (bootstrap): Setting RequestsLibrary::$class_name to \WpOrg\Requests\Requests (0.009s)
Debug (bootstrap): Processing bootstrap step: WP_CLI\Bootstrap\DefineProtectedCommands (0.009s)
Debug (bootstrap): Processing bootstrap step: WP_CLI\Bootstrap\LoadExecCommand (0.01s)
Debug (bootstrap): Processing bootstrap step: WP_CLI\Bootstrap\LoadRequiredCommand (0.01s)
Debug (bootstrap): Processing bootstrap step: WP_CLI\Bootstrap\IncludePackageAutoloader (0.01s)
Debug (bootstrap): Skipped loading packages. (0.01s)
Debug (bootstrap): Processing bootstrap step: WP_CLI\Bootstrap\IncludeFallbackAutoloader (0.01s)
Debug (bootstrap): Fallback autoloader paths: phar://wp-cli.phar/vendor/autoload.php (0.01s)
Debug (bootstrap): Loading detected autoloader: phar://wp-cli.phar/vendor/autoload.php (0.01s)
Debug (bootstrap): Attaching command 'config edit' to hook before_wp_load (0.015s)
Debug (bootstrap): Attaching command 'config path' to hook before_wp_load (0.015s)
Debug (bootstrap): Attaching command 'config list' to hook before_wp_load (0.015s)
Debug (bootstrap): Attaching command 'config get' to hook before_wp_load (0.015s)
Debug (bootstrap): Attaching command 'config is-true' to hook before_wp_load (0.015s)
Debug (bootstrap): Attaching command 'config set' to hook before_wp_load (0.015s)
Debug (bootstrap): Attaching command 'config delete' to hook before_wp_load (0.015s)
Debug (bootstrap): Attaching command 'config has' to hook before_wp_load (0.015s)
Debug (bootstrap): Attaching command 'config shuffle-salts' to hook before_wp_load (0.015s)
Debug (commands): Adding command: config (0.016s)
Debug (bootstrap): Attaching command 'core download' to hook before_wp_load (0.017s)
Debug (bootstrap): Attaching command 'core version' to hook before_wp_load (0.018s)
Debug (commands): Adding command: core (0.018s)
Debug (bootstrap): Attaching command 'eval' to hook before_wp_load (0.018s)
Debug (commands): Adding command: eval (0.018s)
Debug (bootstrap): Attaching command 'eval-file' to hook before_wp_load (0.018s)
Debug (commands): Adding command: eval-file (0.018s)
Debug (commands): Adding command: cache (0.019s)
Debug (commands): Adding command: transient (0.02s)
Debug (bootstrap): Attaching command 'core verify-checksums' to hook before_wp_load (0.02s)
Debug (commands): Adding command: verify-checksums in core Namespace (0.02s)
Debug (commands): Adding command: plugin (0.021s)
Debug (commands): Adding command: verify-checksums in plugin Namespace (0.021s)
Debug (commands): Adding command: cron (0.021s)
Debug (commands): Adding command: event in cron Namespace (0.022s)
Debug (commands): Adding command: schedule in cron Namespace (0.022s)
Debug (bootstrap): Attaching command 'db' to hook after_wp_config_load (0.024s)
Debug (bootstrap): Attaching command 'db clean' to hook after_wp_load (0.024s)
Debug (bootstrap): Attaching command 'db tables' to hook after_wp_load (0.024s)
Debug (bootstrap): Attaching command 'db size' to hook after_wp_load (0.024s)
Debug (bootstrap): Attaching command 'db prefix' to hook after_wp_load (0.024s)
Debug (bootstrap): Attaching command 'db search' to hook after_wp_load (0.025s)
Debug (bootstrap): Attaching command 'db columns' to hook after_wp_load (0.025s)
Debug (commands): Adding command: db (0.025s)
Debug (commands): Adding command: embed (0.025s)
Debug (commands): Adding command: fetch in embed Namespace (0.025s)
Debug (commands): Adding command: provider in embed Namespace (0.026s)
Debug (commands): Adding command: handler in embed Namespace (0.026s)
Debug (commands): Adding command: cache in embed Namespace (0.026s)
Debug (commands): Adding command: comment (0.028s)
Debug (commands): Adding command: meta in comment Namespace (0.029s)
Debug (commands): Adding command: menu (0.03s)
Debug (commands): Adding command: item in menu Namespace (0.03s)
Debug (commands): Adding command: location in menu Namespace (0.031s)
Debug (commands): Deferring command: network meta (0.031s)
Debug (commands): Adding command: option (0.032s)
Debug (commands): Adding command: post (0.033s)
Debug (commands): Adding command: meta in post Namespace (0.033s)
Debug (commands): Adding command: term in post Namespace (0.034s)
Debug (commands): Adding command: post-type (0.034s)
Debug (commands): Adding command: site (0.036s)
Debug (commands): Adding command: meta in site Namespace (0.036s)
Debug (commands): Adding command: option in site Namespace (0.037s)
Debug (commands): Adding command: taxonomy (0.037s)
Debug (commands): Adding command: term (0.038s)
Debug (commands): Adding command: meta in term Namespace (0.039s)
Debug (commands): Adding command: user (0.04s)
Debug (commands): Adding command: application-password in user Namespace (0.041s)
Debug (commands): Adding command: meta in user Namespace (0.041s)
Debug (commands): Adding command: session in user Namespace (0.042s)
Debug (commands): Adding command: term in user Namespace (0.042s)
Debug (commands): Adding command: network (0.042s)
Debug (hooks): Processing hook "after_add_command:network" with 1 callbacks (0.042s)
Debug (hooks): On hook "after_add_command:network": Closure in file phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/class-wp-cli.php at line 697 (0.042s)
Debug (commands): Adding command: meta in network Namespace (0.043s)
Debug (commands): Adding command: signup in user Namespace (0.043s)
Debug (commands): Adding command: export (0.044s)
Debug (commands): Adding command: plugin (0.047s)
Debug (commands): Adding command: auto-updates in plugin Namespace (0.047s)
Debug (commands): Adding command: theme (0.048s)
Debug (commands): Adding command: auto-updates in theme Namespace (0.049s)
Debug (commands): Adding command: mod in theme Namespace (0.049s)
Debug (bootstrap): Attaching command 'i18n' to hook before_wp_load (0.049s)
Debug (commands): Adding command: i18n (0.049s)
Debug (bootstrap): Attaching command 'i18n make-pot' to hook before_wp_load (0.05s)
Debug (commands): Adding command: make-pot in i18n Namespace (0.05s)
Debug (bootstrap): Attaching command 'i18n make-json' to hook before_wp_load (0.051s)
Debug (commands): Adding command: make-json in i18n Namespace (0.051s)
Debug (bootstrap): Attaching command 'i18n make-mo' to hook before_wp_load (0.051s)
Debug (commands): Adding command: make-mo in i18n Namespace (0.052s)
Debug (bootstrap): Attaching command 'i18n make-php' to hook before_wp_load (0.052s)
Debug (commands): Adding command: make-php in i18n Namespace (0.052s)
Debug (bootstrap): Attaching command 'i18n update-po' to hook before_wp_load (0.052s)
Debug (commands): Adding command: update-po in i18n Namespace (0.052s)
Debug (commands): Adding command: import (0.053s)
Debug (commands): Deferring command: language core (0.054s)
Debug (commands): Deferring command: language plugin (0.054s)
Debug (commands): Deferring command: language theme (0.055s)
Debug (hooks): Immediately invoking on passed hook "after_add_command:site": Closure in file phar:///usr/local/bin/wp/vendor/wp-cli/language-command/language-command.php at line 39 (0.055s)
Debug (commands): Adding command: switch-language in site Namespace (0.055s)
Debug (commands): Adding command: language (0.055s)
Debug (hooks): Processing hook "after_add_command:language" with 3 callbacks (0.055s)
Debug (hooks): On hook "after_add_command:language": Closure in file phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/class-wp-cli.php at line 697 (0.055s)
Debug (commands): Adding command: core in language Namespace (0.056s)
Debug (hooks): On hook "after_add_command:language": Closure in file phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/class-wp-cli.php at line 697 (0.056s)
Debug (commands): Adding command: plugin in language Namespace (0.056s)
Debug (hooks): On hook "after_add_command:language": Closure in file phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/class-wp-cli.php at line 697 (0.056s)
Debug (commands): Adding command: theme in language Namespace (0.057s)
Debug (bootstrap): Attaching command 'maintenance-mode' to hook after_wp_load (0.057s)
Debug (commands): Adding command: maintenance-mode (0.057s)
Debug (commands): Adding command: media (0.059s)
Debug (bootstrap): Attaching command 'package' to hook before_wp_load (0.06s)
Debug (commands): Adding command: package (0.06s)
Debug (commands): Adding command: rewrite (0.061s)
Debug (commands): Adding command: rewrite (0.061s)
Debug (commands): Adding command: cap (0.061s)
Debug (commands): Adding command: role (0.062s)
Debug (commands): Adding command: scaffold (0.063s)
Debug (commands): Adding command: search-replace (0.064s)
Debug (bootstrap): Attaching command 'server' to hook before_wp_load (0.065s)
Debug (commands): Adding command: server (0.065s)
Debug (commands): Adding command: shell (0.065s)
Debug (commands): Adding command: super-admin (0.065s)
Debug (commands): Adding command: widget (0.066s)
Debug (commands): Adding command: sidebar (0.066s)
Debug (bootstrap): Processing bootstrap step: WP_CLI\Bootstrap\RegisterFrameworkCommands (0.066s)
Debug (bootstrap): Adding framework command: phar://wp-cli.phar/vendor/wp-cli/wp-cli/php/commands/cli.php (0.066s)
Debug (bootstrap): Attaching command 'cli' to hook before_wp_load (0.067s)
Debug (bootstrap): Attaching command 'cli has-command' to hook after_wp_load (0.068s)
Debug (commands): Adding command: cli (0.068s)
Debug (bootstrap): Attaching command 'cli cache' to hook before_wp_load (0.068s)
Debug (commands): Adding command: cache in cli Namespace (0.068s)
Debug (bootstrap): Attaching command 'cli alias' to hook before_wp_load (0.068s)
Debug (commands): Adding command: alias in cli Namespace (0.068s)
Debug (bootstrap): Adding framework command: phar://wp-cli.phar/vendor/wp-cli/wp-cli/php/commands/help.php (0.068s)
Debug (commands): Adding command: help (0.069s)
Debug (bootstrap): Processing bootstrap step: WP_CLI\Bootstrap\RegisterDeferredCommands (0.069s)
Debug (bootstrap): Processing bootstrap step: WP_CLI\Bootstrap\InitializeContexts (0.069s)
Debug (bootstrap): Processing bootstrap step: WP_CLI\Bootstrap\LaunchRunner (0.07s)
Debug (bootstrap): No readable global config found (0.07s)
Debug (bootstrap): No project config found (0.07s)
Debug (bootstrap): argv: /usr/local/bin/wp plugin install --skip-themes --skip-packages --activate https://wordpress.org/plugins/orbisius-seo-editor/ --debug (0.07s)
Debug (bootstrap): ABSPATH defined: /var/www/vhosts/qsandbox.com/users/sites/site1/htdocs/ (0.07s)
Debug (hooks): Executing hook: before_wp_load (0.07s)
Debug (context): Using context 'cli' (0.07s)
Debug (bootstrap): Begin WordPress load (0.07s)
Debug (bootstrap): wp-config.php path: /var/www/vhosts/qsandbox.com/users/sites/site1/htdocs/wp-config.php (0.07s)
Debug (bootstrap): Looking for UTF-8 BOM (0.07s)
Debug (bootstrap): Looking for UTF-16 (BE) BOM (0.07s)
Debug (bootstrap): Looking for UTF-16 (LE) BOM (0.07s)
Debug (hooks): Executing hook: after_wp_config_load (0.07s)
Debug (bootstrap): Loaded WordPress (0.321s)
Debug (hooks): Processing hook "before_run_command" with 1 callbacks (0.321s)
Debug (hooks): On hook "before_run_command": WP_CLI\Bootstrap\RegisterDeferredCommands->add_deferred_commands() (0.321s)
Debug (bootstrap): Running command: plugin install (0.321s)
Downloading installation package from https://wordpress.org/plugins/orbisius-seo-editor/...
Unpacking the package...
Warning: The package could not be installed. "PCLZIP_ERR_BAD_FORMAT (-10) : Unable to find End of Central Dir Record signature"
Warning: The 'https://wordpress.org/plugins/orbisius-seo-editor/' plugin could not be found.
Error: No plugins installed.

lordspace avatar May 14 '25 13:05 lordspace

just tested to pass a direct link to the zip file and it worked.

'/usr/local/bin/wp' plugin install --path='/var/www/vhosts/qsandbox.com/users/sites/site1/htdocs' --skip-themes --skip-packages --activate 'https://downloads.wordpress.org/plugin/orbisius-seo-editor.zip' Downloading installation package from https://downloads.wordpress.org/plugin/orbisius-seo-editor.zip... Unpacking the package... Installing the plugin... Plugin installed successfully. Activating 'orbisius-seo-editor'... Plugin 'orbisius-seo-editor' activated. Success: Installed 1 of 1 plugins.

lordspace avatar May 14 '25 13:05 lordspace

Citing the docs (wp plugin install --help):

  <plugin|zip|url>...
    One or more plugins to install. Accepts a plugin slug, the path to a local zip file, or a URL to a remote zip file.

A URL like https://wordpress.org/plugins/orbisius-seo-editor/ does not fit this requirement.

Either use the plugin slug (wp plugin install orbisius-seo-editor) or a full ZIP file path/URL (wp plugin install https://downloads.wordpress.org/plugin/orbisius-seo-editor.zip). But other URLs like that are not supported.

swissspidy avatar May 14 '25 16:05 swissspidy

Hmm, I think we could detect those URLs and just strip them down to their slug. The error messages are somewhat misleading here, so why not just support this case?

schlessera avatar May 14 '25 18:05 schlessera

yeah. That's what I use in some of the code. It's good that WP org has pretty standard plugin and theme links.

lordspace avatar May 14 '25 20:05 lordspace