• Resolved cloneofghosts

    (@cloneofghosts)


    We’ve noticed that when we have caching enabled the plugin is causing critical errors when searching and you hit the cached results. If you don’t hit the cached results or have the option disabled everything works fine. The error message we are seeing is the following:

    PHP Fatal error: Uncaught Error: Attempt to assign property “score” on int in /var/web/staging/public_html/wp-content/plugins/better-search/includes/class-better-search.php:885

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Ajay

    (@ajay)

    I will take a look at that. Clearly seems a mismatch between int vs object. Are you seeing it on all posts or just a few?

    Thread Starter cloneofghosts

    (@cloneofghosts)

    We see it on all search results page no matter what the search term and the results are.

    Plugin Author Ajay

    (@ajay)

    I am unable to replicate this but I’m wondering if you have any plugin that changes the output of get_posts() function to return post IDs instead of post Objects. Would you be able to check that?

    Are you in a position to modify the file. If so, before 882 which is the comment, can you do an array map as below. I’m trying to force the $posts to return a post object in case something is overwriting the output of get_posts

    $posts = array_map( 'get_post', $posts );
    // Set the score for each of the posts.
    
    Thread Starter cloneofghosts

    (@cloneofghosts)

    I added that code to the plugin and it fixed the issue. It wouldn’t surprise me if a plugin changed something with get_posts as the site has a ton of plugins installed.

    Plugin Author Ajay

    (@ajay)

    Thank you for confirming. I’ll put that into the main plugin anyway, as I think it will help protect from other plugins as well.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Fatal error when viewing cached search’ is closed to new replies.