Skip to content

[CLI] Throws a message for invalid WordPress version #2816

@fellyph

Description

@fellyph

Prerequisites

  • I have carried out troubleshooting steps and I believe I have found a bug.
  • I have searched for similar bugs in both open and closed issues and cannot find a duplicate.

Describe the bug

When an invalid value is passed to the flag --wp on playground CLI, it loads the latest version without notifying the users. It can be confusing if the user passes an invalid flag.

for example, I have requested the beta version, similar behavior to the web version of the playground, and it downloads version 6.8.3:

npx @wp-playground/cli@latest server --version=beta   
Starting a PHP server...
Setting up WordPress latest
Resolved WordPress release URL: https://downloads.w.org/release/wordpress-6.8.3.zip
Fetching SQLite integration plugin...
Booting WordPress...
PHP.request() is deprecated. Please use the new PHPRequestHandler() instead.
Booted!
Running the Blueprint...
Running the Blueprint – 100%
Finished running the blueprint
WordPress is running on http://127.0.0.1:9400 with 1 worker(s)

First, I was confused it was a bug on the CLI related to the beta version, later I realized beta is not a valid value for the flag --wp:

npx @wp-playground/cli@latest server --version=brazil 
Starting a PHP server...
Setting up WordPress latest
Resolved WordPress release URL: https://downloads.w.org/release/wordpress-6.8.3.zip
Fetching SQLite integration plugin...
Booting WordPress...
PHP.request() is deprecated. Please use new PHPRequestHandler() instead.
Booted!
Running the Blueprint...
Running the Blueprint – 100%
Finished running the blueprint
WordPress is running on http://127.0.0.1:9400 with 1 worker(s)

Expected behavior

The CLI should notify the user that the flag is not valid

  • Ideally, suggest one of the valid versions without crashing

Actual behavior

The CLI is loading the latest version without notifying users that the flag has an invalid value

Steps to reproduce

  1. Go to the terminal
  2. Run npx @wp-playground/cli@latest server --version=brazil
  3. Check the output

Isolating the problem

  • I have deactivated other plugins and confirmed this bug occurs when only this plugin is active.
  • This bug happens with a default WordPress theme active.
  • I can reproduce this bug consistently using the steps above.

Metadata

Metadata

Assignees

Labels

[Type] BugAn existing feature does not function as intended

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions