Fixed Deprecated exception with search in certain situations


Affected version
  • PHP: 8.1.3
  • DB: 10.7.3 (10.7.3-MariaDB-1:10.7.3+maria~focal)
Happens on the most recent 2.2.9 but first discovered with 2.2.8. This happens/is displayed only with development mode on. If the logged in user is admin, the error doesn't come up. This happens at least when clicking post total in member popup or "postings" tab on member profile page. Happens too if I use search and search by member.

ErrorException: [E_DEPRECATED] strlen(): Passing null to parameter #1 ($string) of type string is deprecated src/XF/Search/Source/MySqlFt.php:217

Stack trace:

#0 src/XF/Search/Source/MySqlFt.php(217): XF::handlePhpError(8192, '[E_DEPRECATED] ...', 's...', 217)
#1 src/XF/Search/Search.php(185): XF\Search\Source\MySqlFt->search(Object(XF\Search\Query\KeywordQuery), '200')
#2 src/XF/Search/Search.php(214): XF\Search\Search->XF\Search\{closure}(Object(XF\Search\Query\KeywordQuery), '200')
#3 src/XF/Search/Search.php(181): XF\Search\Search->executeSearch(Object(XF\Search\Query\KeywordQuery), '200', Object(Closure), true)
#4 src/XF/Pub/Controller/Member.php(679): XF\Search\Search->search(Object(XF\Search\Query\KeywordQuery))
#5 src/XF/Mvc/Dispatcher.php(352): XF\Pub\Controller\Member->actionRecentContent(Object(XF\Mvc\ParameterBag))
#6 src/XF/Mvc/Dispatcher.php(259): XF\Mvc\Dispatcher->dispatchClass('XF:Member', 'RecentContent', Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\Member), NULL)
#7 src/XF/Mvc/Dispatcher.php(115): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\Member), NULL)
#8 src/XF/Mvc/Dispatcher.php(57): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#9 src/XF/App.php(2352): XF\Mvc\Dispatcher->run()
#10 src/XF.php(524): XF\App->run()
#11 index.php(20): XF::runApp('XF\\Pub\\App')
#12 {main}
Request state

Request state:
array(4) {
  ["url"] => string(157) "/members/mode.3/recent-content?_xfRequestUri=%2Fmembers%2Fmode.3%2F&_xfWithData=1&_xfToken=1651857153%2C498a7e7d1326f0d4e4d060bc409916b9&_xfResponseType=json"
  ["referrer"] => string(39) "http://domain.test/members/mode.3/"
  ["_GET"] => array(5) {
    ["/members/mode_3/recent-content"] => string(0) ""
    ["_xfRequestUri"] => string(16) "/members/mode.3/"
    ["_xfWithData"] => string(1) "1"
    ["_xfToken"] => string(43) "1651857153,498a7e7d1326f0d4e4d060bc409916b9"
    ["_xfResponseType"] => string(4) "json"
  ["_POST"] => array(0) {

XF Bug Bot

XenForo bug fixer bot
Staff member
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.2.11).

Change log:
Fix PHP 8.1 compatibility issue when performing a search with no keywords
There may be a delay before changes are rolled out to the XenForo Community.