• Resolved Brian Shim

    (@brianrshim)


    First of all, thank you for this great plugin!

    I get a critical “out of memory” error when I do a search with no search term entered. Details:

    Error Level: E_ERRORMessage: Allowed memory size of 268435456 bytes exhausted (tried to allocate 268435464 bytes)
    File: /var/www/disablemycable.com/htdocs/wp-content/plugins/better-search/includes/utilities.phpLine: 447
    Request: /?s=
    Referrer: https%3A%2F%2Fwww.disablemycable.com%2F

    My PHP memory is set to 256M.

    Can you fix this?

    Thanks,
    Brian

    The page I need help with: [log in to see the link]

Viewing 12 replies - 1 through 12 (of 12 total)
  • Thread Starter Brian Shim

    (@brianrshim)

    I confirmed this problem on two other Divi sites and one using the GeneratePress theme.

    Plugin Author Ajay

    (@ajay)

    @brianrshim

    Are you in a position to disable other plugins and give this a try? Ideally do this one at a time.

    I’m unable to replicate this in my production and test sites.

    Also, do you have some kind of stack trace in the error to see what functions are calling?

    Thread Starter Brian Shim

    (@brianrshim)

    Hi Ajay,

    Thanks for your response. I traced the conflicting plugin to the Lightspeed Cache plugin:
    https://www.ads-software.com/plugins/litespeed-cache/

    The memory error only happens when that plugin is activated. It doesn’t matter if the cache is on or off though. Either way, with that plugin activated, the memory crash happens when search term is blank.

    Error also only happens with Better Search’s “Enable seamless integration” set to OFF. When set to ON, the crash doesn’t happen.

    You can view the problem here:
    https://test.brianshim.com/?s=

    And I’m happy to give you admin rights to that server if you want.

    I wasn’t able to find a simple solution. But would it be possible to add a switch (in the UI or action hook) to Better Search to give a message like “Please enter a search term” if the search term is blank (i.e., /?s=) ?

    Many thanks,
    Brian

    Plugin Author Ajay

    (@ajay)

    Thanks for this tracing. Also helps knowing this is limited to the non-seamless mode. So it’s likely something in the template. For some reason the plugin thinks there is a search term when there isn’t.

    I’ll try to see if I can replicate this in my test server – will be easier for me to trace and debug vs your test site.

    Thread Starter Brian Shim

    (@brianrshim)

    Great, thanks Ajay. Let me know if you need anything from me.

    Best,
    Brian

    Plugin Author Ajay

    (@ajay)

    @brianrshim

    I think I have a solution for this. Will you be able to make an edit to the utilities.php file above – Line 446 should be changed to:

    
    while ( ! empty( $loc ) ) {
    
    Thread Starter Brian Shim

    (@brianrshim)

    Hi Ajay,

    I did the update and it solved the crash! See clean result here (no longer crashing):
    https://test.brianshim.com/?s=

    I look forward to seeing it in the next revision.

    Many thanks!!!

    Best,
    Brian

    Plugin Author Ajay

    (@ajay)

    @brianrshim

    I’ve fixed this in GitHub and it will part of the next release.

    Thread Starter Brian Shim

    (@brianrshim)

    Awesome, thank you Ajay!

    Thread Starter Brian Shim

    (@brianrshim)

    HI Ajay,

    Can you tell me when the next release will be coming? It doesn’t look like this fix is in the released code yet.

    Thanks,
    Brian

    Plugin Author Ajay

    (@ajay)

    I haven’t had the time to finalise a release. However, there is this beta in GitHub which has this fixed if you’d like to give it a go.

    https://github.com/WebberZone/better-search/releases/tag/v3.2.0-beta1

    Thread Starter Brian Shim

    (@brianrshim)

    Thanks. I implemented your fix manually and it works great.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Critical memory error for blank searches’ is closed to new replies.