• Resolved bbyrne

    (@bbyrne)


    Updating to 1.4.18 caused search to break on my site; downgrading to 1.4.17 resolves the issue. It appears to be a conflict with Relevanssi, as deactivating that also resolves the issue.

    Here’s the abridged stack trace:
    <b>Fatal error</b>: Uncaught Error: Object of class stdClass could not be converted to string in /Users/bbyrne/Local Sites/nanostring-prod/app/public/wp-content/plugins/modern-footnotes/modern-footnotes.php:293
    Stack trace:#0 /Users/bbyrne/Local Sites/nanostring-prod/app/public/wp-content/plugins/modern-footnotes/modern-footnotes.php(262): modern_footnotes_get_post_scope_id()#1 /Users/bbyrne/Local Sites/nanostring-prod/app/public/wp-includes/class-wp-hook.php(324): modern_footnotes_reset_count('\n&lt;h2 class=&quot;wp-...')#2 /Users/bbyrne/Local Sites/nanostring-prod/app/public/wp-includes/plugin.php(205): WP_Hook-&gt;apply_filters('\n&lt;h2 class=&quot;wp-...', Array)#3 /Users/bbyrne/Local Sites/nanostring-prod/app/public/wp-content/plugins/relevanssi-premium/lib/excerpts-highlights.php(140): apply_filters('the_content', '&lt;!-- wp:heading...')#4 /Users/bbyrne/Local Sites/nanostring-prod/app/public/wp-content/plugins/relevanssi-premium/lib/excerpts-highlights.php(1644): relevanssi_do_excerpt(Object(stdClass), 'cancer', '30', 'words')#5 /Users/bbyrne/Local Sites/nanostring-prod/app/public/wp-content/plugins/relevanssi-premium/lib/search.php(699): relevanssi_add_excerpt(Object(stdClass), 'cancer')#6 /Users/bbyrne/Local Sites/nanostring-prod/app/public/wp-content/plugins/relevanssi-premium/lib/search.php(88): relevanssi_do_query(Object(WP_Query))

    In debugging this myself, it looks like what’s in $GLOBALS['post'] after Relevanssi is done with it is no longer an instance of WP_Post, but rather a basic stdClass, which causes modern_footnotes_get_post_scope_id() to fail to set $global_post_id to an integer, instead leaving it as a class.

    Might be better to change the logic in modern_footnotes_get_post_scope_id() to check if $global_post is an integer first, then check if it’s a(ny) class having a property of ID, rather than assuming it will always be either an integer or a WP_Post? (Honestly, I’d say Relevanssi should be doing a better job of making sure what’s in $GLOBALS['post'] is a post object, too….)

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter bbyrne

    (@bbyrne)

    Update from the Relevannsi side: Because Relevanssi supports including things like users and taxonomy terms in search results, WP_Post is not necessarily the object type that will be in $GLOBALS['post'] during the search result loop — this is why stdClass gets used.

    Hey, just chiming in to say I’m encountering this too since the last update. Same situation with Relevanssi. Rolling back a to 1.4.17 resolves things–please let us know when there’s a fix in. And thank you for a great plugin!

    Plugin Author prismtechstudios

    (@prismtechstudios)

    Thanks for reporting this, @bbyrne and @invisibleira. I wasn’t able to reproduce the issue on my end, but I just did an update to the plugin that should hopefully fix this issue. Could you try version 1.4.19 and see if it works on your side?

    Thanks,
    Sean

    Thank you so much, Sean–that did the trick for me!

    Thread Starter bbyrne

    (@bbyrne)

    I can also confirm it’s working in my environments. Thanks, prismtechstudios!

    Plugin Author prismtechstudios

    (@prismtechstudios)

    Thank you both for confirming!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘v1.4.18 breaks search’ is closed to new replies.