SimpleMachines / SMF

Simple Machines Forum — SMF in short — is free and open-source community forum software, delivering professional grade features in a package that allows you to set up your own online community within minutes!
https://www.simplemachines.org/
Other
596 stars 255 forks source link

Unable to search PMs #7678

Open jdarwood007 opened 1 year ago

jdarwood007 commented 1 year ago

Description

I'm getting this at simplemachines.org. I can't reproduce it in my own environment though.

[php:error] [client ********:0] PHP Fatal error:  Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /Sources/PersonalMessage.php:1757\nStack trace:\n#0 /Sources/Subs.php(6016): MessageSearch2()\n#1 /Sources/PersonalMessage.php(220): call_helper()\n#2 /index.php(191): MessageMain()\n#3 {main}\n  thrown in /Sources/PersonalMessage.php on line 1757, referer: https://www.simplemachines.org/community/index.php?action=pm;sa=search

Steps to reproduce

  1. Unknown reason. I can't search some subjects.

Environment (complete as necessary)

Additional information/references

I think this is an issue with a PM that is not labeled correctly. Sometime during the upgrade, my labels/rules got corrupted and I had rules that no longer applied labels and the checkbox applied to unselect the inbox was applied. Resulting in some of my PMs being sent to the void. I suspect the search is finding these partial PMs and thus the error.

Seems like at least for this error, we should have it more gracefully error out using a nullable check to default to 0.

jeffythedragonslayer commented 1 year ago

Ok, so you can't search some subjects, but what subject did you search?

jdarwood007 commented 1 year ago

It was for a subject matching a PM I had. I think it again is due to corrupted PMs not being assigned labels due to bad rules.