Fixed Searching for custom user field gives error

Mr. Jinx

Well-known member
I have created a 'single line text box' custom user field.
Going to Users > Search for users. If I enter a value to search for in the custom user field, I get this error:

ErrorException: [E_WARNING] array_merge(): Expected parameter 1 to be an array, string given in src/XF/Searcher/User.php at line 151
  1. XF::handlePhpError()
  2. array_merge() in src/XF/Searcher/User.php at line 151
  3. XF\Searcher\User->applySpecialCriteriaValue() in src/XF/Searcher/AbstractSearcher.php at line 401
  4. XF\Searcher\AbstractSearcher->applyCriteriaValue() in src/XF/Searcher/AbstractSearcher.php at line 394
  5. XF\Searcher\AbstractSearcher->applyCriteria() in src/XF/Searcher/AbstractSearcher.php at line 361
  6. XF\Searcher\AbstractSearcher->getFinder() in src/XF/Admin/Controller/User.php at line 61
  7. XF\Admin\Controller\User->actionList() in src/XF/Mvc/Dispatcher.php at line 321
  8. XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 244
  9. XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 100
  10. XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 50
  11. XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2177
  12. XF\App->run() in src/XF.php at line 390
  13. XF::runApp() in admin.php at line 13
 
We do not appear to be able to reproduce this, so is there any more information you can give with regards to how that user field is set up?

I have simply created a single line text box custom field and when I perform a search in it (with stuff I expect to match, or not) then I get the expected behaviour without any error.
 
Ah, I see this only happens in a rare situation when the Field ID is a number and does not start with a character.
Try a single line box with Field ID 2000 for example @Chris D. I could reproduce it.

1566051883307.png
 
Last edited:
Thank you for reporting this issue. It has now been resolved and we are aiming to include it in a future XF release (2.1.4).

Change log:
Add workaround to prevent error when searching content in the admin panel based on value of custom field with numeric ID
Any changes made as a result of this issue being resolved may not be rolled out here until later.
 
Top Bottom