Support » Plugin: Advanced Excerpt » Php error when searching with empty search field or with non-existing word

  • Hi,

    I get a php error when I try to search a word that does not exist on my site. This php error also occurs when the search field is left empty and then click on the search button.

    When I deactivate the Advanced Excerpt plugin this php error does no longer occur.

    Is anyone familiar with this?

    Greetings,
    Abu Maryam

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author WPKube

    (@wpkube)

    Hi @abu-maryam

    I don’t think that issue was reported before.

    I just tried it out on my installation and I’m just getting the regular “nothing found” content.

    Can you send over the error code that it displays? Should be a specific line in a file and the short description of what the error is.

    Hi,

    thanks for your rapid reply and sorry for my late reply.
    This is the php error that occurs as I’ve described:

    ( ! ) Fatal error: Uncaught Error: Maximum function nesting level of '256' reached, aborting! in C:\wamp64\www\wp-includes\functions.php on line 6413
    
    ( ! ) Error: Maximum function nesting level of '256' reached, aborting! in C:\wamp64\www\wp-includes\functions.php on line 6413

    Thanks again!
    Abu Maryam

    Plugin Author WPKube

    (@wpkube)

    Hi @abu-maryam

    Something causes an infinite loop in there and it’s stopped at 256th loop to avoid going indefinitely (or until it hits the time limit for a script execution).

    Can you do a quick test, switch to a default WP theme (TwentyTwenty for example) and see if the issue happens with it as well. No need to activate the TwentyTwenty theme, just go to WP admin > Appearance > Customize, in there you can “preview” a different theme.

    That way we can rule out a conflict between the plugin and the theme.

    If the issues happens with the default theme as well then send over a list of plugin you use, I’ll set up the same ones to see if there’s a conflict with any of them.

    • This reply was modified 8 months, 1 week ago by WPKube.

    Hi,

    Currently I’m using the Astra Pro theme (from Brainstorm Force).
    After changing to the Twenty Twenty theme the problem was still occuring.
    So it was not the theme.

    But I found what caused the problem.
    It was the plugin Ultimate Addons for Gutenberg (also from Brainstorm Force).
    Somehow this plugin interferes with the Advances Excerpt plugin.
    After deactivating the Ultimate Addons for Gutenberg plugin, the problem was gone!

    Can you give it a look and try find out why this happens?

    Thanks a lot!
    Abu Maryam

    Plugin Author WPKube

    (@wpkube)

    Hi @abu-maryam

    Just tried it but the issue does not happen.

    So it might be a specific setup of one or both plugins to get it to happen. Or it might be a conflict between 3 plugins (the issue happens only when all 3 are active).

    Can you check if the issue happens when having only Advanced Excerpt and Ultimate Addons plugins active.

    I see you’re running on a local WAMP install, are you comfortable with changing PHP code? If you are, there’s a few things we can try out to speed up the debug process.

    Hello,

    I think I found the real problem.
    When installing the Ultimate Addons for Gutenberg plugin and the Advanced Excerpt plugin separately, then the php error does not show up. Also when having them both installed without using the blocks of the UAG plugin, then also no php error.

    The php error is caused when using the post blocks of the UAG plugin AND disabling the excerpt option in those blocks. Blocks like post grid, post masonry and post carousel, which all have the option to enable or disable the excerpt.

    So when disabling the excerpt of these UAG post blocks, then I get the php error. It’s like the Advanced Excerpt plugin is looking for an excerpt in those blocks, but it can’t any excerpt. So it keeps looking untill the php error occurs. When enabling the excerpt of the UAG post blocks, then there is no php error.

    Hope this helps.
    Maybe you can try it out.

    Thanks a lot,
    Abu Maryam

    • This reply was modified 8 months, 1 week ago by Abu Maryam.
    Plugin Author WPKube

    (@wpkube)

    Hi @abu-maryam

    Thanks for the detailed explanation.

    In advanced-excerpt/class/advanced-excerpt.php on line 275 you’ll see:

    $text = apply_filters( 'the_content', $text );

    Change that to:

    if ( ! doing_filter( 'the_content' ) ) {
        $text = apply_filters( 'the_content', $text );
    }

    It should fix the issue. Let me know how it goes.

    Yes!!!
    The code you have provided works great!!!

    Thank you so much for your time and efford!
    Great support!

    Will this piece of code be implemented in a future version of the Advanced Excerpt plugin or is it something only I have to in my own version?

    Thanks again!
    Abu Maryam

    Plugin Author WPKube

    (@wpkube)

    Hi @abu-maryam

    You’re welcome, happy to hear it worked out. If you can, please consider rating the plugin, would be of great help, thanks.

    Yeah, will be included in the next update.

    Hi,

    sorry for getting back again.
    So I told you that the php error after searching an unfound word was fixed by using the code you’ve provided.

    But what I noticed a day later was that the generated excerpt in the UAG post block was not showing embeded YouTube videos from the posts anymore. The YouTube videos are imported in the posts by using a video block. This block uses <figure><div>youtube url-address</figure></div>. Excluding these html tags in “Strip Tag” section of the Advanced Excerpt plugin doesn’t work.

    I don’t know if it’s a good idea to change the code in your upcoming version or even which code is correct without effecting other functionalities.

    At the moment I take the php error (after searching an unfound word) for granted and use the original code in advanced-excerpt/class/advanced-excerpt.php on line 275:

    $text = apply_filters( 'the_content', $text );

    Thanks again for your time!
    Abu Maryam

    • This reply was modified 8 months, 1 week ago by Abu Maryam.
    • This reply was modified 8 months, 1 week ago by Abu Maryam.

    Hi,

    after a small adjustment to your code, I found that the code works for all the issues I’ve described when using:

    if ( ! doing_filter( 'the_excerpt' ) ) {
        $text = apply_filters( 'the_content', $text );
    }

    So when using ‘the_excerpt’ instead of ‘the_content’ the php error doesn’t occur anymore and the videos are embeded and shown correctly.

    Maybe this is a helpful addition to our discussion.

    Thanks a lot and this subject can now be considered as really solved!!!

    Abu Maryam

    Plugin Author WPKube

    (@wpkube)

    Hi @abu-maryam

    Thanks for the info, will test that out. The issue is due to the infinite loop of the_content filter being called inside of the_content filter so it just keeps on calling it.

    Will test it out with the check for the_excerpt instead. If you notice any issues these days with the new approach please let me know.

    Thank you.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Php error when searching with empty search field or with non-existing word’ is closed to new replies.