• Hi Mikko!

    Hope all is well. Sorry to trouble you with this, but after updating to version 4.11.0, it seems like anytime I search for a Stopword Candidate, it gives a WordPress error:

    There has been a critical error on this website.
    Learn more about debugging in WordPress.

    I can give you the URL in private message upon request (sorry it’s a development site) but I have tried with other terms and it seems to work fine, it’s just the Stopword Candidates that breaks it.

    I have tried disabling and re-enabling the plugin, rebuilding the index etc, without luck.

    Any ideas what could be causing this?

    Thanks!

    • This topic was modified 3 years, 10 months ago by whereverpanda.
Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Mikko Saari

    (@msaari)

    That’s unusual. Those are the most common words, so it’s possible this is a some kind of performance problem.

    Can you please tell me the exact error message you’re getting? That WordPress error should always be accompanied with an actual error message in the server error log, so if you can tell me what that error message is, that would be very helpful.

    Thread Starter whereverpanda

    (@whereverpanda)

    Hi Mikko,

    I’m not sure if this is what you are looking for, but this is what is in the error_log document in the WordPress root for one one of the search terms that is a stopword candidate (the word ‘network’):

    [02-Feb-2021 06:27:42 UTC] PHP Fatal error:  Uncaught TypeError: Argument 1 passed to relevanssi_strip_tags() must be of the type string, null given, called in /xxx/xxx/xxx/xxx/wp-content/plugins/relevanssi/lib/excerpts-highlights.php on line 184 and defined in /xxx/xxx/xxx/xxx/wp-content/plugins/relevanssi/lib/utils.php:737
    Stack trace:
    #0 /xxx/xxx/xxx/xxx/wp-content/plugins/relevanssi/lib/excerpts-highlights.php(184): relevanssi_strip_tags(NULL)
    #1 /xxx/xxx/xxx/xxx/wp-content/plugins/relevanssi/lib/search.php(1006): relevanssi_do_excerpt(Object(stdClass), 'network', '20', 'words')
    #2 /xxx/xxx/xxx/xxx/wp-content/plugins/relevanssi/lib/search.php(94): relevanssi_do_query(Object(WP_Query))
    #3 /xxx/xxx/xxx/xxx/wp-includes/class-wp-hook.php(287): relevanssi_query(NULL, Object(WP_Query))
    #4 /xxx/xxx/xxx/xxx/wp-includes/plugin.php(255): WP_Hook->apply_filters(NULL, Array)
    #5 /xxx/xxx/xxx/xxx/wp-includes/class-wp-query.php(2951): apply_filters_ref_array('po in /xxx/xxx/xxx/xxx/wp-content/plugins/relevanssi/lib/utils.php on line 737

    (I just replaced the filepaths with ‘xxx’)

    Again, this message might 100% tell me what’s wrong but I’m not savvy with this at all.

    Plugin Author Mikko Saari

    (@msaari)

    The actual problem here is that the content in the post found does not exist for some reason and the relevanssi_strip_tags() function does not like that, it doesn’t approve.

    For a quick fix, adding this to your theme functions.php should help:

    add_filter( 'relevanssi_excerpt_content', function( $content ) {
      if ( empty( $content ) ) {
        $content = '';
      }
      return $content;
    }, 99 );
    Thread Starter whereverpanda

    (@whereverpanda)

    Hi Mikko,

    Unfortunately this did not seem to work. Could this be an Oxygen builder issue again?

    I have tested with some other random words now and it does indeed give the WordPress error now (after disabling your code again) for words that are in the page content and not part of the Stopwords Candidates list. In fact it seems to give that error for words in the Oxygen page content, but not for words that are put into the Oxygen content with shortcodes (from other plugins like Easy Accordions). So when I used a word in an accordion that isn’t used anywhere else inside the actual Oxygen page content, it will give a result for the page on which that shortcode is embedded.

    Here is an example of an error that is not a stopword candidate:

    [02-Feb-2021 07:02:12 UTC] PHP Fatal error:  Uncaught TypeError: Argument 1 passed to relevanssi_strip_tags() must be of the type string, null given, called in /xxx/xxx/xxx/xxx/wp-content/plugins/relevanssi/lib/excerpts-highlights.php on line 184 and defined in /xxx/xxx/xxx/xxx/wp-content/plugins/relevanssi/lib/utils.php:737
    Stack trace:
    #0 /xxx/xxx/xxx/xxx/wp-content/plugins/relevanssi/lib/excerpts-highlights.php(184): relevanssi_strip_tags(NULL)
    #1 /xxx/xxx/xxx/xxx/wp-content/plugins/relevanssi/lib/search.php(1006): relevanssi_do_excerpt(Object(stdClass), 'metro', '20', 'words')
    #2 /xxx/xxx/xxx/xxx/wp-content/plugins/relevanssi/lib/search.php(94): relevanssi_do_query(Object(WP_Query))
    #3 /xxx/xxx/xxx/xxx/wp-includes/class-wp-hook.php(287): relevanssi_query(NULL, Object(WP_Query))
    #4 /xxx/xxx/xxx/xxx/wp-includes/plugin.php(255): WP_Hook->apply_filters(NULL, Array)
    #5 /xxx/xxx/xxx/xxx/wp-includes/class-wp-query.php(2951): apply_filters_ref_array('post in /xxx/xxx/xxx/xxx/wp-content/plugins/relevanssi/lib/utils.php on line 737

    So is this yet again an Oxygen issue?

    Plugin Author Mikko Saari

    (@msaari)

    Yes, this is partially an Oxygen issue, because Oxygen posts don’t have content, and that’s the main root problem here.

    Try replacing the /lib/utils.php with this version of the file: https://github.com/msaari/relevanssi/commit/791b01f57f30cf506dbff7dfd622b50f037276ca

    Does that solve the problem?

    Thread Starter whereverpanda

    (@whereverpanda)

    Hi Mikko,

    It does seem to have solved it thank you so much!

    Will this be included in the next release, or would I need to keep a copy of this file and replace it again when you release a new update for the plugin?

    Thanks again, for you amazing and quick assistance!

    Plugin Author Mikko Saari

    (@msaari)

    This fix will be included in the next version, which will be out later today.

    Thread Starter whereverpanda

    (@whereverpanda)

    Thanks again, Mikko!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘WordPress error when searching for Stopword Candidates’ is closed to new replies.