-
Notifications
You must be signed in to change notification settings - Fork 68
Closed
Milestone
Description
I was testing WP CLI 2.7.0 and the super handy new --orderby=size and --order=desc flags.
These flags work on their own but not when combined with the --size_format=mb flag (which I would hope to make the default since Bytes are not that human-friendly).
With this command under PHP 8.1:
wp db size --tables --all-tables --orderby=size --order=desc --allow-root --size_format=mb
Fatal error output
PHP Fatal error: Uncaught TypeError: Unsupported operand types: string / int in phar:///usr/bin/wp/vendor/wp-cli/db-command/src/DB_Command.php:1105
Stack trace:
#0 [internal function]: DB_Command->size()
#1 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php(100): call_user_func()
#2 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}()
#3 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php(491): call_user_func()
#4 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(419): WP_CLI\Dispatcher\Subcommand->invoke()
#5 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(442): WP_CLI\Runner->run_command()
#6 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1256): WP_CLI\Runner->run_command_and_exit()
#7 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(28): WP_CLI\Runner->start()
#8 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(78): WP_CLI\Bootstrap\LaunchRunner->process()
#9 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php(32): WP_CLI\bootstrap()
#10 phar:///usr/bin/wp/php/boot-phar.php(11): include('...')
#11 /usr/bin/wp(4): include('...')
#12 {main}
thrown in phar:///usr/bin/wp/vendor/wp-cli/db-command/src/DB_Command.php on line 1105
The same error happened without the --tables flag
wp db size --all-tables --orderby=size --order=desc --allow-root --size_format=mb
PHP Version output
php --version
PHP 8.1.11 (cli) (built: Sep 29 2022 22:28:23) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.11, Copyright (c) Zend Technologies
with Zend OPcache v8.1.11, Copyright (c), by Zend Technologies
WP CLI version
wp cli version --allow-root
WP-CLI 2.7.0
Reactions are currently unavailable