Skip to content

Fix fatal error in invalid plugin update offer#354

Merged
danielbachhuber merged 3 commits intomainfrom
292-bail-invalid-version
Mar 3, 2023
Merged

Fix fatal error in invalid plugin update offer#354
danielbachhuber merged 3 commits intomainfrom
292-bail-invalid-version

Conversation

@danielbachhuber
Copy link
Member

Fixes #292

I don't want to add feature tests for this because I don't want to pin tests to an outdated version of Elementor that probably won't survive WP and PHP version updates.

With the pull request:

$ wp plugin install elementor --version=3.1.4 --force
Installing Elementor Website Builder (3.1.4)
Success: Installed 1 of 1 plugins.
$ wp plugin update elementor --patch
Success: Plugin already updated.
$ wp plugin update elementor --minor
Plugin updated successfully.
+-----------+-------------+-------------+---------+
| name      | old_version | new_version | status  |
+-----------+-------------+-------------+---------+
| elementor | 3.1.4       | 3.11.2      | Updated |
+-----------+-------------+-------------+---------+
Success: Updated 1 of 1 plugins.

Without the pull request:

$ wp plugin install elementor --version=3.1.4 --force
Installing Elementor Website Builder (3.1.4)
Success: Installed 1 of 1 plugins.
$ wp plugin update elementor --patch
Fatal error: Uncaught UnexpectedValueException: Invalid version string "3.10.0-dev1" in /Users/danielbachhuber/projects/wp-cli-dev/vendor/composer/semver/src/VersionParser.php:186
Stack trace:
#0 /Users/danielbachhuber/projects/wp-cli-dev/vendor/composer/semver/src/Semver.php(39): Composer\Semver\VersionParser->normalize('3.10.0-dev1')

@danielbachhuber danielbachhuber added bug command:plugin Related to 'plugin' command command:plugin-update Related to 'plugin update' command labels Mar 2, 2023
@danielbachhuber danielbachhuber added this to the 2.1.12 milestone Mar 2, 2023
@danielbachhuber danielbachhuber requested a review from a team as a code owner March 2, 2023 23:15
@danielbachhuber danielbachhuber self-assigned this Mar 2, 2023
@swissspidy
Copy link
Member

Surprised that the semver parser throws on this. 3.10.0-dev1 looks like something it's supposed to handle.

@danielbachhuber danielbachhuber merged commit 31ebccb into main Mar 3, 2023
@danielbachhuber danielbachhuber deleted the 292-bail-invalid-version branch March 3, 2023 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug command:plugin Related to 'plugin' command command:plugin-update Related to 'plugin update' command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wp plugin update --all --minor generates error wp plugin update --all works fine.

2 participants