-
Notifications
You must be signed in to change notification settings - Fork 86
Closed
wp-cli/wp-cli
#5894Labels
Description
Bug Report
- Yes, I reviewed the contribution guidelines.
- Yes, more specifically, I reviewed the guidelines on how to write clear bug reports.
Describe the current, buggy behavior
wp plugin update
fails badly if a repository provide unparsable tags.
Describe how other contributors can replicate this bug
- Install
wp-maintenance-mode
2.2.x (It's important to be below the maximum release. 2.2.4 for example) - Run
wp @ae plugin update --patch wp-maintenance-mode
- Encounter an error
Uncaught UnexpectedValueException: Invalid version string "psd-files"
. (See below for the full stacktrace)
Describe what you would expect as the correct outcome
Update (patch release) to work.
Let us know what environment you are running this on
OS: Linux 4.19.0-12-cloud-amd64 #1 SMP Debian 4.19.152-1 (2020-10-18) x86_64
Shell: /bin/bash
PHP binary: /usr/bin/php7.4
PHP version: 7.4.12
php.ini used: /etc/php/7.4/cli/php.ini
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: /etc/cron.d
WP-CLI packages dir:
WP-CLI global config: ~/.wp-cli/config.yml
WP-CLI project config:
WP-CLI version: 2.4.0
(Using Bedrock)
Provide a possible solution
- I suggest to catch errors from
Composer\Semver\Semver::satisfies()
. - I suggest to output the plugin which actually failed. That would spare command-line run/bissecting time (The string
psd-files
is nowhere on the filesystem. Not even~/.composer/cache
).
Provide additional context/Screenshots
https://plugins.svn.wordpress.org/wp-maintenance-mode/tags/
Shows that a psd-files
tags was added.
When wp-maintenance-mode
is at the latest version already, it seems the psd-files
tag is omitted.
But if not, then it triggers an error at /composer/semver/src/VersionParser.php:172
which is not caught.
PHP Fatal error: Uncaught UnexpectedValueException: Invalid version string "psd-files" in phar:///usr/local/bin/wp/vendor/composer/semver/src/VersionParser.php:172
Stack trace:
#0 phar:///usr/local/bin/wp/vendor/composer/semver/src/Semver.php(39): Composer\Semver\VersionParser->normalize()
#1 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/utils.php(785): Composer\Semver\Semver::satisfies()
#2 phar:///usr/local/bin/wp/vendor/wp-cli/extension-command/src/WP_CLI/CommandWithUpgrade.php(583): WP_CLI\Utils\get_named_sem_ver()
#3 phar:///usr/local/bin/wp/vendor/wp-cli/extension-command/src/WP_CLI/CommandWithUpgrade.php(342): WP_CLI\CommandWithUpgrade->get_minor_or_patch_updates()
#4 phar:///usr/local/bin/wp/vendor/wp-cli/extension-command/src/Plugin_Command.php(640): WP_CLI\CommandWithUpgrade->update_many()
#5 [internal function]: Plugin_Command->update()
#6 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php(98): call_user_func()
#7 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\ in phar:///usr/local/bin/wp/vendor/composer/semver/src/VersionParser.php on line 172
Fatal error: Uncaught UnexpectedValueException: Invalid version string "psd-files" in phar:///usr/local/bin/wp/vendor/composer/semver/src/VersionParser.php:172
Stack trace:
#0 phar:///usr/local/bin/wp/vendor/composer/semver/src/Semver.php(39): Composer\Semver\VersionParser->normalize()
#1 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/utils.php(785): Composer\Semver\Semver::satisfies()
#2 phar:///usr/local/bin/wp/vendor/wp-cli/extension-command/src/WP_CLI/CommandWithUpgrade.php(583): WP_CLI\Utils\get_named_sem_ver()
#3 phar:///usr/local/bin/wp/vendor/wp-cli/extension-command/src/WP_CLI/CommandWithUpgrade.php(342): WP_CLI\CommandWithUpgrade->get_minor_or_patch_updates()
#4 phar:///usr/local/bin/wp/vendor/wp-cli/extension-command/src/Plugin_Command.php(640): WP_CLI\CommandWithUpgrade->update_many()
#5 [internal function]: Plugin_Command->update()
#6 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php(98): call_user_func()
#7 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\ in phar:///usr/local/bin/wp/vendor/composer/semver/src/VersionParser.php on line 172
Error: There has been a critical error on your website.Learn more about debugging in WordPress. There has been a critical error on your website