Open jhagrid77 opened 3 months ago
Describe the current, buggy behavior
The option list command with the --autoload option does not search for the new on/off values in WordPress Core 6.6, resulting in no return values.
option list
--autoload
on
off
Describe how other contributors can replicate this bug
[path to wp-cli.phar] option list --autoload=on
[path to wp-cli.phar] option list --autoload=yes
[path to wp-cli.phar] option list --autoload=off
[path to wp-cli.phar] option list --autoload=no
Describe what you would expect as the correct outcome
I would expect that either:
Let us know what environment you are running this on
$ ./wp-cli.phar cli info OS: Linux 5.4.245-200.el7.x86_64 #1 SMP Thu Jun 8 15:58:31 EDT 2023 x86_64 Shell: /bin/bash PHP binary: /opt/remi/php81/root/usr/bin/php PHP version: 8.1.28 php.ini used: /etc/opt/remi/php81/php.ini MySQL binary: /bin/mysql MySQL version: mysql Ver 15.1 Distrib 10.5.23-MariaDB, for Linux (x86_64) using readline 5.1 SQL modes: 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: /chroot/home/ab59ee70/5cb513e4ba.nxcli.io/html WP-CLI packages dir: WP-CLI cache dir: /home/ab59ee70/.wp-cli/cache WP-CLI global config: /home/ab59ee70/.wp-cli/config.yml WP-CLI project config: WP-CLI version: 2.11.0 $ ./wp-cli.phar core version 6.6.1
Provide a possible solution
The following code could be updated to one of the following: https://github.com/wp-cli/entity-command/blob/da6f7bf4c5e2c7e544803eb4592fd3c257b5a137/src/Option_Command.php#L275-L284
1 - search for both values:
if ( isset( $assoc_args['autoload'] ) ) { $autoload = $assoc_args['autoload']; if ( 'on' === $autoload || 'yes' === $autoload ) { $autoload_query = " AND (autoload='on') OR autoload='yes')"; } elseif ( 'off' === $autoload || 'no' === $autoload ) { $autoload_query = " AND (autoload='off' OR autoload='no')"; } else { WP_CLI::error( "Value of '--autoload' should be 'on', 'off', 'yes', or 'no'." ); } }
2 - split for individual values:
if ( isset( $assoc_args['autoload'] ) ) { $autoload = $assoc_args['autoload']; if ( 'on' === $autoload ) { $autoload_query = " AND autoload='on'"; } elseif ( 'yes' === $autoload ) { $autoload_query = " AND autoload='yes'"; } elseif ( 'off' === $autoload ) { $autoload_query = " AND autoload='off'"; } elseif ( 'no' === $autoload ) { $autoload_query = " AND autoload='no'"; } else { WP_CLI::error( "Value of '--autoload' should be 'on', 'off', 'yes', or 'no'." ); } }
Provide additional context/Screenshots
$ ./wp-cli.phar option list --autoload=on +-------------+--------------+ | option_name | option_value | +-------------+--------------+ +-------------+--------------+ $ ./wp-cli.phar option list --autoload=yes +-------------+--------------+ | option_name | option_value | +-------------+--------------+ +-------------+--------------+ $ ./wp-cli.phar option list --autoload=off +-------------+--------------+ | option_name | option_value | +-------------+--------------+ +-------------+--------------+ $ ./wp-cli.phar option list --autoload=no +-------------+--------------+ | option_name | option_value | +-------------+--------------+ +-------------+--------------+
Good catch, thanks!
Bug Report
Describe the current, buggy behavior
The
option list
command with the--autoload
option does not search for the newon
/off
values in WordPress Core 6.6, resulting in no return values.Describe how other contributors can replicate this bug
[path to wp-cli.phar] option list --autoload=on
[path to wp-cli.phar] option list --autoload=yes
[path to wp-cli.phar] option list --autoload=off
[path to wp-cli.phar] option list --autoload=no
Describe what you would expect as the correct outcome
I would expect that either:
Let us know what environment you are running this on
Provide a possible solution
The following code could be updated to one of the following: https://github.com/wp-cli/entity-command/blob/da6f7bf4c5e2c7e544803eb4592fd3c257b5a137/src/Option_Command.php#L275-L284
1 - search for both values:
2 - split for individual values:
Provide additional context/Screenshots