Fixed Error going to page 2 of user search results


Well-known member
Affected version
2.2.8 Patch 1
If "exact match" is selected, with no email, then on navigating to page 2 of the search results an error is thrown.

ErrorException: [E_WARNING] Undefined array key "address" src/XF/Searcher/User.php:134

#0 src/XF/Searcher/User.php(134): XF::handlePhpError(2, '[E_WARNING] Und...', '/var/www/sites/...', 134)
#1 src/XF/Searcher/AbstractSearcher.php(409): XF\Searcher\User->applySpecialCriteriaValue(Object(XF\Finder\User), 'email', Array, Array, 'like', NULL)
#2 src/XF/Searcher/AbstractSearcher.php(402): XF\Searcher\AbstractSearcher->applyCriteriaValue(Object(XF\Finder\User), 'email', Array, Array, 'like', NULL)
#3 src/XF/Searcher/AbstractSearcher.php(365): XF\Searcher\AbstractSearcher->applyCriteria(Object(XF\Finder\User), Array)
#4 src/XF/Admin/Controller/User.php(62): XF\Searcher\AbstractSearcher->getFinder()
#5 src/XF/Mvc/Dispatcher.php(350): XF\Admin\Controller\User->actionList(Object(XF\Mvc\ParameterBag))
#6 src/XF/Mvc/Dispatcher.php(257): XF\Mvc\Dispatcher->dispatchClass('XF:User', 'List', Object(XF\Mvc\RouteMatch), Object(XF\Admin\Controller\User), NULL)
#7 src/XF/Mvc/Dispatcher.php(113): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Admin\Controller\User), NULL)
#8 src/XF/Mvc/Dispatcher.php(55): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#9 src/XF/App.php(2344): XF\Mvc\Dispatcher->run()
#10 src/XF.php(512): XF\App->run()
#11 admin.php(13): XF::runApp('XF\\Admin\\App')
#12 {main}

if ($key == 'email')
   if (is_array($value))
      $email = $value['address'];
This is the line that is triggering it, but the issue is "exact match" is being added into the filter options when it isn't valid. A similar error likely exists for the username field.

I think the fix should be $email = $value['address'] ?? '' as this allows for finding users without an email address. This is possible on the first page, but fails on the second page.
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.9).

Change log:
Fix an error that could occur when navigating search results after performing an exact match search for users but not providing a value for the username or email
There may be a delay before changes are rolled out to the XenForo Community.
Top Bottom