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

How about an official mailing about this instead of us having to google our way to this page due to seeing hundreds of errors in our logs? Really sloppy.
I opened a support ticket and was directed to this thread in just a few hours. :) No Googling lol
 
General rule of thumb:
Unless it's an urgent security issue don't immediately install new versions when they become available - wait a few days to let the dust settle down.
On something like this, it could be weeks/months before the next version of XF is released. Waiting a few days would not change anything. As a matter of fact, it has been a few days already. If I am not mistaken, the first update in 2022 was not until April and this was the second release of 2022.

The workaround posted above worked for me- https://xenforo.com/community/threa...erty-result_count-on-null.207377/post-1583275
 
Ya know people, in the end, I didn't bother with the workaround. The problem is almost cosmetic as it just means clearing a few errors every day, so it's no real hardship and I'd rather not fiddle with something that's working properly in every other way. XF will soon release an official fix for this, anyway.

I remember we had a similar problem with fake errors a few months ago that were soon patched out.
 
On something like this, it could be weeks/months before the next version of XF is released. Waiting a few days would not change anything.
I would have preferred to wait weeks/months rather than have the errors of the health check nag. So yes, in future I will probably wait a few days
 
If the health check error bothers you, you can choose one of those options
  1. Restore the original file
  2. Delete the checksum for it from src/addons/XF/hashes.json
  3. Update the checksum
  4. Entirely delete hashes.json
  5. Use an Add-on to selectively supress specific checksum errors
  6. Probably endless more options
 
Last edited:
If the health check error bothers you, you can choose one of those options
  1. Restore the original file
  2. Delete the checksum for it from src/addons/XF/hashes.json
  3. Update the checksum
  4. Entirely delete hashes.json
  5. Use an Add-on to selectively supress specific checksum errors
6. a cron to delete server error log entries that contain this error message every minute
 
You won't need to.

Upgrading will overwrite the file.
Not if the fix is in another file, there maybe just some outside assumptions that got wrong with the last update.

The workaround here that came from myself initially is pretty safe though and worked OK since Thursday, also, it'd be easy to remove even if a fix gets out that doesn't touch this file, as it's just three lines to delete:
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 three lines to the actionResults function before the $page = $this->filterPage(); line in src/XF/Pub/Controller/Search.php:

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)
 
Top Bottom