Skip to content

Conversation

@swissspidy
Copy link
Member

When using a currently nightly build and running wp cli update without any arguments, it couldn't find any version, which caused some PHP warnings.

$ wp cli update
PHP Warning:  Undefined array key "available" in phar:///Users/pascalb/.local/bin/wp/vendor/wp-cli/wp-cli/php/commands/src/CLI_Command.php on line 330

Warning: Undefined array key "available" in phar:///Users/pascalb/.local/bin/wp/vendor/wp-cli/wp-cli/php/commands/src/CLI_Command.php on line 330
PHP Warning:  Trying to access array offset on null in phar:///Users/pascalb/.local/bin/wp/vendor/wp-cli/wp-cli/php/commands/src/CLI_Command.php on line 334

Warning: Trying to access array offset on null in phar:///Users/pascalb/.local/bin/wp/vendor/wp-cli/wp-cli/php/commands/src/CLI_Command.php on line 334
You have version 2.12.0-alpha-842fe5d. Would you like to update to ? [y/n]

That's because $update['available'] doesn't exist. The right array key & check is $update['status'] === 'available' 🤦

@swissspidy swissspidy added the command:cli-update Related to 'cli update' command label Apr 2, 2025
@swissspidy swissspidy added this to the 2.12.0 milestone Apr 2, 2025
@swissspidy swissspidy requested a review from a team as a code owner April 2, 2025 10:01
@codecov
Copy link

codecov bot commented Apr 2, 2025

Codecov Report

Attention: Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
php/commands/src/CLI_Command.php 0.00% 5 Missing ⚠️

📢 Thoughts on this report? Let us know!

@swissspidy swissspidy merged commit 2e2c3c8 into main Apr 2, 2025
49 of 52 checks passed
@swissspidy swissspidy deleted the fix/update-check branch April 2, 2025 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

command:cli-update Related to 'cli update' command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants