MyBB Community Forums

Full Version: Searching for "orange" will find "angel" in non-fulltext search
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Non-Fulltext-Search in MyBB ignores "and" and "or" of the first entered keyword of the search.
If I search for "orange", MyBB will actually search for "ange". I can't search for "andi", because Mybb will complain that my search keyword is only one character long.

The reason is a bug in clean_keywords function:

https://github.com/mybb/mybb/blob/featur...h.php#L243
https://github.com/mybb/mybb/blob/featur...h.php#L248

At these lines, "and" and "or" will be removed from the search string, if they are at the beginning of the first keyword.

I suggest removing the two "if"-statements completely, as they are broken in many ways. Not only will they currently unintentionally remove the first characters of a matching keyword, they also don't protect against "and" and "or" keywords at the first position of a search query (the intention of these lines) if fixed to not cut off longer keywords:

"or test" would become "test" (correct)
"and test" would become "test" (correct)
"or or test" would become "or test" (wrong)
"and and test" would become "and test" (wrong)
"or and test" would become "test" (correct)
"and or test" woud become "or test" (wrong)
and so on ...
I agree
Hi,

Thank you for your report. We have pushed this issue to our Github repository for further analysis where you can track our commits and progress with fixing this bug. Discussions regarding this bug may also take place there too.

Follow this link to visit the issue on Github: https://github.com/mybb/mybb/issues/2349

Thanks for contributing to MyBB!

Regards,
The MyBB Group