• Good Reviews for WordPress: WP-CLI fatal error when global controller is null

    On a site running PHP 8.4 and Good Reviews for WordPress 2.3.14, wp plugin list fails while loading the plugin:

    Call to a member function check_permission() on null
    includes/Settings.class.php:416

    show_submit_button() declares global $grfwp_controller and calls $grfwp_controller->permissions->check_permission(). The controller is assigned at file scope near the end of good-reviews-wp.php. During WP-CLI loading, that assignment appears not to populate the global variable read by show_submit_button(). Running the same command with --skip-plugins=good-reviews-wp succeeds, which isolates the failure to this plugin.

    Please test explicitly declaring the global before the assignment:

    // Global instance
    global $grfwp_controller;
    $grfwp_controller = grfwpInit::instance();

    The plugin may also benefit from checking that the controller and permissions object exist before calling check_permission(). Re-uploading version 2.3.14 did not resolve the error.

You must be logged in to reply to this topic.