Fixed [E_WARNING] Attempt to read property "result_count" on null

Yeah I rather have a daily file integrity warning until a fix is released than dozens of error log entries per minute..

So I applied the following diff as stop gap:

Diff:
--- src/XF/Pub/Controller/Search.orig.php    2022-07-14 09:15:02.888904630 +0200
+++ src/XF/Pub/Controller/Search.php    2022-07-14 09:14:47.017272442 +0200
@@ -143,12 +143,16 @@ class Search extends AbstractController
             }
             else if ($search && $search->search_query && $search->search_query !== $this->filter('q', 'str'))
             {
                 return $this->notFound();
             }
         }
+        # [ TL: workaround regression of 2.2.10 producing many errors with guests searching ]
+        if (!is_object($search)) {
+            return $this->message(\XF::phrase('no_results_found'));
+        }
 
         $page = $this->filterPage();
         $perPage = $this->options()->searchResultsPerPage;
 
         $this->assertValidPage($page, $perPage, $search->result_count, 'search', $search);

IOW, add the following hunk to the actionResults function before the $page = $this->filterPage(); line:

PHP:
if (!is_object($search)) {
    return $this->message(\XF::phrase('no_results_found'));
}

Stopped the error messages from piling up and didn't see any bad effect (albeit the actual fix is probably different)

@tlamprecht

What are you editing here? What php file or what template? I'm not sure what a DIFF is or how/where to apply it.
 
Thanks, I might just try that. Just had a look and you know those 72 pages of errors? It's now sitting at 934! And that's after clearing the 72 at the time I posted.

View attachment 270970

Well, this fix will definitely help! And you can then clear those "errors."

Note that you may get a different error message from the files healthchecker. But it's better than a thousand pages of errors, imho. :)

c7048fb0c349fab40722cc6c7db02e21.webp
 
@creativeforge I'm scared to run that health checker now...

I just had to dive in and install the damned update immediately, didn't I? 🤦‍♂️

Yeah, I could try to roll it back from my backup, but that might just cause more problems by turning an inconvenience into a crisis if the site drops out of the sky. I'll see about applying that temp fix. It's not likely to screw up further updates, is it?

@Pixel Princess @Arantor Please facepalm for me.
 
@creativeforge I'm scared to run that health checker now...

I just had to dive in and install the damned update immediately, didn't I? 🤦‍♂️

Yeah, I could try to roll it back from my backup, but that might just cause more problems turning an inconvenience into a crisis if the site drops out of the sky. I'll see about applying that temp fix. It's not likely to screw up further updates, is it?

@Pixel Princess @Arantor Please facepalm for me.

No, it won't screw up anything, it's just a function of error logs. What I will do is, when the patch is ready and tested, I'll remove that added code in the search.php file, and THEN I'll run the patch.

The health-checker seems to be part of Xenforo's automatic scanning. You don't have to do anything, it will come up by itself, if I understand correctly.

And a lot of us didn't have any idea this would happen, so don't beat yourself up. :) I thought the same thing - why didn't I wait 2 weeks like I usually do for any updates (Xenforo, WordPress, etc).
 
Top Bottom