WordPress / plugin-check

A repository for the new Plugin Check plugin from the WordPress Performance and Plugins Team.
https://wordpress.org/plugins/plugin-check/
GNU General Public License v2.0
198 stars 39 forks source link

AJAX error when only Accessibility is checked #342

Closed ernilambar closed 6 months ago

ernilambar commented 6 months ago

When only Accessibility is checked, AJAX error halts the check.

Steps to reproduce

Output

In the console:

Screen Shot 2023-12-17 at 1 05 28 PM

This is the error in debug.log file:

[17-Dec-2023 07:22:25 UTC] PHP Fatal error:  Uncaught TypeError: WordPress\Plugin_Check\Checker\Abstract_Check_Runner::set_check_slugs(): Argument #1 ($check_slugs) must be of type array, null given, called in /var/www/html/wp-content/plugins/plugin-check/includes/Admin/Admin_AJAX.php on line 115 and defined in /var/www/html/wp-content/plugins/plugin-check/includes/Checker/Abstract_Check_Runner.php:168
Stack trace:
#0 /var/www/html/wp-content/plugins/plugin-check/includes/Admin/Admin_AJAX.php(115): WordPress\Plugin_Check\Checker\Abstract_Check_Runner->set_check_slugs(NULL)
#1 /var/www/html/wp-includes/class-wp-hook.php(324): WordPress\Plugin_Check\Admin\Admin_AJAX->set_up_environment('')
#2 /var/www/html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)
#3 /var/www/html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#4 /var/www/html/wp-admin/admin-ajax.php(188): do_action('wp_ajax_plugin_...')
#5 {main}
  thrown in /var/www/html/wp-content/plugins/plugin-check/includes/Checker/Abstract_Check_Runner.php on line 168
ernilambar commented 6 months ago

After some digging I found out that this error is coming because there are no Checks under Accessibility category. So $checks variable became null but we require that variable as array. So it generated PHP fatal error.

mukeshpanchal27 commented 6 months ago

Thanks @ernilambar for raising. I also reproduce same error. Assign to my self.