-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Labels
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
When running wp profile stage ... and you provide an invalid field to display, it will Fatal Error.
The error is:
PHP Fatal error: Uncaught TypeError: Unsupported operand types: string + null in [removed]/.wp-cli/packages/vendor/wp-cli/profile-command/src/Formatter.php:134
Stack trace:
#0 [removed]/.wp-cli/packages/vendor/wp-cli/profile-command/src/Formatter.php(47): WP_CLI\Profile\Formatter->show_table('ASC', NULL, Array, Array, true)
#1 [removed]/.wp-cli/packages/vendor/wp-cli/profile-command/src/Command.php(187): WP_CLI\Profile\Formatter->display_items(Array, true, 'ASC', NULL)
#2 [internal function]: WP_CLI\Profile\Command->stage(Array, Array)
#3 phar:///usr/local/bin/wp-cli/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php(100): call_user_func(Array, Array, Array)
#4 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}(Array, Array)
#5 phar:///usr/local/bin/wp-cli/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php(497): call_user_func(Object(Closure), Array, Array)
#6 phar:///usr/local/bin/wp-cli/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(470): WP_CLI\Dispatcher\Subcommand->invoke(Array, Array, Array)
#7 phar:///usr/local/bin/wp-cli/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(493): WP_CLI\Runner->run_command(Array, Array)
#8 phar:///usr/local/bin/wp-cli/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(136): WP_CLI\Runner->run_command_and_exit()
#9 phar:///usr/local/bin/wp-cli/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1228): WP_CLI\Runner->do_early_invoke('before_wp_load')
#10 phar:///usr/local/bin/wp-cli/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(28): WP_CLI\Runner->start()
#11 phar:///usr/local/bin/wp-cli/vendor/wp-cli/wp-cli/php/bootstrap.php(84): WP_CLI\Bootstrap\LaunchRunner->process(Object(WP_CLI\Bootstrap\BootstrapState))
#12 phar:///usr/local/bin/wp-cli/vendor/wp-cli/wp-cli/php/wp-cli.php(35): WP_CLI\bootstrap()
#13 phar:///usr/local/bin/wp-cli/php/boot-phar.php(20): include('phar:///usr/loc...')
#14 /usr/local/bin/wp-cli(4): include('phar:///usr/loc...')
#15 {main}
thrown in [removed]/.wp-cli/packages/vendor/wp-cli/profile-command/src/Formatter.php on line 134
Describe how other contributors can replicate this bug
Run any wp profile stage command with an invalid field supplied to --fields: wp profile stage template --fields=test will result in the above error.
Describe what you would expect as the correct outcome
Expected behavior is to either:
- Fail gracefully and ignore. in the case of the example command, it should treat it as if no
--fieldswas supplied. In the case that there are valid fields, the invalid field should just be ignored.
OR
- Provide a meaningful failure message eg.
field 'test' is invalid.
Let us know what environment you are running this on
OS: Linux 5.15.167.4-microsoft-standard-WSL2 #1 SMP Tue Nov 5 00:21:55 UTC 2024 x86_64
Shell:
PHP binary: /usr/bin/php8.1
PHP version: 8.1.32
php.ini used: /etc/php/8.1/cli/php.ini
MySQL binary: /usr/bin/mariadb
MySQL version: mariadb Ver 15.1 Distrib 10.11.11-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper
SQL modes: STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
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-cli
WP-CLI packages dir: [removed]/.wp-cli/packages/
WP-CLI cache dir: [removed]/.wp-cli/cache
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 2.12.0