profile-command
profile-command copied to clipboard
Warning: count(): Parameter must be an array or an object that implements Countable inc/class-logger.php on line 65
Bug Report
- [x] Yes, I reviewed the contribution guidelines.
- [x] Yes, more specifically, I reviewed the guidelines on how to write clear bug reports.
Warning: count(): Parameter must be an array or an object that implements Countable in /home/domain/.wp-cli/packages/vendor/wp-cli/profile-command/inc/class-logger.php on line 65
With this command: wp profile hook --all -spotlight --url=https://www.domain.tld
@Mte90 Please post wp --info
output.
OS: Linux 3.10.0-957.12.2.el7.x86_64 #1 SMP Tue May 14 21:24:32 UTC 2019 x86_64
Shell: /bin/bash
PHP binary: /opt/cpanel/ea-php72/root/usr/bin/php
PHP version: 7.2.18
php.ini used: /opt/cpanel/ea-php72/root/etc/php.ini
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: /home/domain/public_html
WP-CLI packages dir: /home/domain/.wp-cli/packages/
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 2.2.0
Try remove profile-command
package. this issue should be fixed in https://github.com/wp-cli/profile-command/pull/151 (https://github.com/wp-cli/profile-command/pull/151/commits/c612994363d81a37fd560dcad17433413c0f315e).
If I remove the package I don't have the command anymore.
If I reinstall I get the same error.
Looking at the code https://github.com/wp-cli/profile-command/blob/master/inc/class-logger.php#L65 seems that we assert that queries
is an array but seems that this is not the default behavior https://codex.wordpress.org/Class_Reference/wpdb#Class_Variables
So maybe on line 64 is better to use is_array
together with empty
to do the check.
I know it's been a while, but is this still an issue? Seems like it can't hurt to add an is_array()
check there or so.