Skip to content

Fatal Error in DB Query Collector #956

@emrikol

Description

@emrikol

Every now and then I get the following fatal error in Query Monitor. It's rather benign, but I figured I would share anyway. I took a quick through existing issues and didn't see anything. Apologies if it's a duplicate.

Uncaught Error: count(): Argument #1 ($value) must be of type Countable|array, null given
in /srv/htdocs/wp-content/plugins/query-monitor/collectors/db_queries.php on line 231

Call stack:

    QM_Collector_DB_Queries::process_db_object()
    wp-content/plugins/query-monitor/collectors/db_queries.php:77
    QM_Collector_DB_Queries::process()
    wp-content/plugins/query-monitor/classes/Collectors.php:84
    QM_Collectors::process()
    wp-content/plugins/query-monitor/classes/Dispatcher.php:123
    QM_Dispatcher::get_outputters('html')
    wp-content/plugins/query-monitor/dispatchers/Html.php:358
    QM_Dispatcher_Html::before_output()
    wp-content/plugins/query-monitor/dispatchers/Html.php:322
    QM_Dispatcher_Html::dispatch('')
    wp-includes/class-wp-hook.php:324
    WP_Hook::apply_filters(NULL, array)
    wp-includes/class-wp-hook.php:348
    WP_Hook::do_action(array)
    wp-includes/plugin.php:517
    do_action('shutdown')
    wp-includes/load.php:1279
    shutdown_action_hook()

This appears to be happening at:

$this->data->total_qs = count( $this->data->rows );

I'm sure a quick is_countable() or array casting would "fix" it but not necessarily the underling reason why.

A refresh of the page always returns it back to working order.

PHP
Version 8.3.16
SAPI fpm-fcgi
User 150630904:site150630904
max_execution_time 850
memory_limit 512M
upload_max_filesize 2047M
post_max_size 2047M
display_errors
log_errors 1
Error Reporting 4983
Database
Server Version 10.6.15-MariaDB-log
Extension mysqli
Client Version 80316 (8.3.16)
User 150630904
Host 127.0.0.1
Database 150630904
innodb_buffer_pool_size 34359738368 (~32 GB)
key_buffer_size 134217728 (~128 MB)
max_allowed_packet 104857600 (~100 MB)
max_connections 500
WordPress
Version 6.7.2
Environment Type (Help) production
Development Mode (Help) empty string
WP_DEBUG false
WP_DEBUG_DISPLAY false
WP_DEBUG_LOG false
SCRIPT_DEBUG false
WP_CACHE true
CONCATENATE_SCRIPTS undefined
COMPRESS_SCRIPTS undefined
COMPRESS_CSS undefined
WP_ENVIRONMENT_TYPE production
WP_DEVELOPMENT_MODE empty string
Server
Software nginx
Version Unknown
IP Address 103.115.9.139
Host pool186-E02-23.dfw.atomicsites.net (Pressable)
OS Linux 5.10.0-23-amd64
Architecture x86_64
Basic Auth false

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions