• sherriw6

    (@sherriw6)


    While investigating the security problem I found that the plugin wasn’t working on our new server in which we migrated our site from PHP version 8.0 to 8.2. The plugin’s use of wp-admin/admin-ajax.php is throwing a 500 error with the message:

    Fatal error: Uncaught Error: Cannot use a scalar value as an array in /var/www/vhosts/example.com/httpdocs/wp-content/plugins/favorites/app/Entities/Favorite/FavoritesArrayFormatter.php:73

    Fix for PHP version 8.2:

    In file: wp-content/plugins/favorites/app/Entities/Favorite/FavoritesArrayFormatter.php

    Line 73:

    Wrap the line in a if statement:

    if (array_key_exists($favorite, $this->formatted_favorites[$site]['posts']) &&
    is_array($this->formatted_favorites[$site]['posts'][$favorite])) {
    $this->formatted_favorites[$site]['posts'][$favorite]['post_id'] = $favorite;
    }

You must be logged in to reply to this topic.