• Was getting this from the admin-ajax requests on the front end “[11-Aug-2022 14:10:31 UTC] PHP Fatal error: Uncaught Error: Cannot use a scalar value as an array in /files/wp-content/plugins/favorites/app/Entities/Favorite/FavoritesArrayFormatter.php:73”

    I noticed $formatted_favorites was set to null so I added this if statement to clear the error (“if(!empty($formatted_favorites)){“). Not sure what the value of $formatted_favorites should be but this seems to suppress the error.
    https://gist.github.com/someguy9/084c608860a0e6e5c47595c1b3f49163

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Andy Feliciotti

    (@someguy9)

    Realized my answer didn’t make sense, all you need to add is “$this->formatted_favorites[$site][‘posts’][$favorite] = array();” before the original line to fix the PHP8 error.

    I just switched to PHP 8 and had the same problem (well, the actual error listed was different but same file/line). Thanks for the fix. Hope the developer adds this before the next update.

    • This reply was modified 1 year, 11 months ago by mojamba.

    @someguy9

    I am having the same issue.

    Can you confirm where in the FavoritesArrayFormatter.php the fix goes

    Also when you say add is “$this->formatted_favorites[$site][‘posts’][$favorite] = array();” before the original line

    Do you mean the line you added in the first post?

    Im not a coder so hope you can help

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Fatal error on admin ajax loads’ is closed to new replies.