• Resolved wvanhona

    (@wvanhona)


    Hello we get this oerror now every 4-5 minutes from your plugin.

    Can you please check how to fix?

    [15-Sep-2025 13:08:34 UTC] PHP Fatal error: Uncaught TypeError: array_unshift(): Argument #1 ($array) must be of type array, null given in /home/heylifeo/www/heylifeo.myhostpoint.ch/fitntasty2023/wp-content/plugins/wp-reviews-plugin-for-google/trustindex-plugin.class.php:328
    Stack trace: 0 /home/heylifeo/www/heylifeo.myhostpoint.ch/fitntasty2023/wp-content/plugins/wp-reviews-plugin-for-google/trustindex-plugin.class.php(328): array_unshift(NULL, ‘<a style=”backg…’, ‘<a href=”https:…’) 1 /home/heylifeo/www/heylifeo.myhostpoint.ch/fitntasty2023/wp-includes/class-wp-hook.php(326): TrustindexPlugin_google->add_plugin_action_links(NULL, ‘wp-reviews-plug…’) 2 /home/heylifeo/www/heylifeo.myhostpoint.ch/fitntasty2023/wp-includes/plugin.php(205): WP_Hook->apply_filters(NULL, Array) 3 /home/heylifeo/www/heylifeo.myhostpoint.ch/fitntasty2023/wp-content/plugins/woocommerce-payments/vendor/automattic/jetpack-sync/src/modules/class-callables.php(399): apply_filters(‘plugin_action_l…’, Array, ‘wp-reviews-plug…’, Array, ‘all’) 4 /home/heylifeo/www/heylifeo.myhostpoint.ch/fitntasty2023/wp-includes/class-wp-hook.php(324): Automattic\Jetpack\Sync\Modules\Callables->set_plugin_action_links(Object(WP_Screen)) 5 /home/heylifeo/www/heylifeo.myhostpoint.ch/fitntasty2023/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) 6 /home/heylifeo/www/heylifeo.myhostpoint.ch/fitntasty2023/wp-includes/plugin.php(517): WP_Hook->do_action(Array) 7 /home/heylifeo/www/heylifeo.myhostpoint.ch/fitntasty2023/wp-admin/includes/class-wp-screen.php(424): do_action(‘current_screen’, Object(WP_Screen)) 8 /home/heylifeo/www/heylifeo.myhostpoint.ch/fitntasty2023/wp-admin/includes/screen.php(243): WP_Screen->set_current_screen() 9 /home/heylifeo/www/heylifeo.myhostpoint.ch/fitntasty2023/wp-content/plugins/woocommerce-payments/vendor/automattic/jetpack-sync/src/class-sender.php(530): set_current_screen(‘sync’) 10 /home/heylifeo/www/heylifeo.myhostpoint.ch/fitntasty2023/wp-content/plugins/woocommerce-payments/vendor/automattic/jetpack-sync/src/class-sender.php(632): Automattic\Jetpack\Sync\Sender->get_items_to_send(Object(Automattic\Jetpack\Sync\Queue_Buffer), true) 11 /home/heylifeo/www/heylifeo.myhostpoint.ch/fitntasty2023/wp-content/plugins/woocommerce-payments/vendor/automattic/jetpack-sync/src/class-sender.php(487): Automattic\Jetpack\Sync\Sender->do_sync_for_queue(Object(Automattic\Jetpack\Sync\Queue)) 12 /home/heylifeo/www/heylifeo.myhostpoint.ch/fitntasty2023/wp-content/plugins/woocommerce-payments/vendor/automattic/jetpack-sync/src/class-sender.php(425): Automattic\Jetpack\Sync\Sender->do_sync_and_set_delays(Object(Automattic\Jetpack\Sync\Queue)) 13 /home/heylifeo/www/heylifeo.myhostpoint.ch/fitntasty2023/wp-content/plugins/woocommerce-payments/vendor/automattic/jetpack-sync/src/class-actions.php(196): Automattic\Jetpack\Sync\Sender->do_dedicated_sync_and_exit() 14 /home/heylifeo/www/heylifeo.myhostpoint.ch/fitntasty2023/wp-includes/class-wp-hook.php(324): Automattic\Jetpack\Sync\Actions::add_dedicated_sync_sender_init(”) 15 /home/heylifeo/www/heylifeo.myhostpoint.ch/fitntasty2023/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) 16 /home/heylifeo/www/heylifeo.myhostpoint.ch/fitntasty2023/wp-includes/plugin.php(517): WP_Hook->do_action(Array) 17 /home/heylifeo/www/heylifeo.myhostpoint.ch/fitntasty2023/wp-settings.php(727): do_action(‘init’) 18 /home/heylifeo/www/heylifeo.myhostpoint.ch/fitntasty2023/wp-config.php(111): require_once(‘/home/heylifeo/…’) 19 /home/heylifeo/www/heylifeo.myhostpoint.ch/fitntasty2023/wp-load.php(50): require_once(‘/home/heylifeo/…’) 20 /home/heylifeo/www/heylifeo.myhostpoint.ch/fitntasty2023/wp-blog-header.php(13): require_once(‘/home/heylifeo/…’) 21 /home/heylifeo/www/heylifeo.myhostpoint.ch/fitntasty2023/index.php(17): require(‘/home/heylifeo/…’) 22 {main}

    thrown in /home/heylifeo/www/heylifeo.myhostpoint.ch/fitntasty2023/wp-content/plugins/wp-reviews-plugin-for-google/trustindex-plugin.class.php on line 328
    [

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter wvanhona

    (@wvanhona)

    Here is the reply from Chatgpt to fix. Can you please check your code?

    That fatal comes from a sloppy callback in the Trustindex “Google Reviews” plugin: it calls array_unshift() on $links when $links is null. Jetpack/WooCommerce Payments is triggering the generic plugin_action_links filter in a context where $links can be null, and the plugin didn’t guard for it.

    Here’s how to fix it fast and safely. Get your site back up (if you’re locked out)

    1. Via SFTP/SSH or your host’s file manager, go to:
      wp-content/plugins/
    2. Rename the folder:
      wp-reviews-plugin-for-googlewp-reviews-plugin-for-google.disabled
    3. Reload wp-admin. (WordPress will auto-deactivate the plugin.)

    Permanent fix (edit the plugin)

    Open:
    wp-content/plugins/wp-reviews-plugin-for-google/trustindex-plugin.class.php

    Find the method that looks like this (around line ~328), e.g.:

    public function add_plugin_action_links( $links, $file ) { // ... array_unshift( $links, '<a style="background:...">', '<a href="https://...">' ); return $links; }

    Patch it to be defensive and to return early for other plugins:

    public function add_plugin_action_links( $links, $file = '' ) { // Only act on this plugin’s own row, not all plugins $this_plugin = plugin_basename( __FILE__ ); // or the main plugin file basename if available if ( ! empty( $file ) && $file !== $this_plugin ) { return $links; } // Be defensive: $links can be null if ( ! is_array( $links ) ) { $links = []; } // Your action links $extra = [ '<a style="background:...">...</a>', '<a href="https://...">...</a>', ]; // Prepend and return foreach ( array_reverse( $extra ) as $a ) { array_unshift( $links, $a ); } return $links; }

    If they’re hooking the generic filter, change it to the plugin-specific one:

    // BEFORE (too generic, can receive null and runs for every plugin row) add_filter( 'plugin_action_links', [ $this, 'add_plugin_action_links' ], 10, 2 ); // AFTER (only for this plugin’s row) add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), [ $this, 'add_plugin_action_links' ], 10, 1 );

    …and then update the method signature to accept just $links if you switch to the plugin-specific hook. If you don’t want to edit vendor code

    Drop a tiny mu-plugin to harden the filter globally:

    Create wp-content/mu-plugins/harden-plugin-action-links.php with:

    <?php /** * Hardens plugin_action_links so misbehaving plugins don’t fatal when $links is null. */ add_filter( 'plugin_action_links', function( $links, $plugin_file = '', $plugin_data = [], $context = '' ) { // Make sure $links is always an array. if ( ! is_array( $links ) ) { $links = []; } return $links; }, 1, 4 ); Then

    • Re-enable the Trustindex plugin.
    • Update it to the latest version (this is a PHP 8.x compatibility edge case).
    • If the plugin updates overwrite your patch, keep the mu-plugin in place or ask the vendor to adopt the guard + plugin-specific hook.

    If you paste me the exact code block around line 328, I can give you the precise one-line change for your file.

    Plugin Support Laca

    (@lacadev)

    Hi @wvanhona

    Thanks for reporting the issue.
    We’ve fixed this bug — please update to the latest version of the plugin.

    Let us know if the problem is resolved after updating.

    Kind regards,
    Laca from Trustindex

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Fatal error on plugin’ is closed to new replies.