ErrorException: [E_WARNING] Array to string conversion if custom field has unexpected value

Kirby

Well-known member
Affected version
2.2.18, 2.3.9 & xenforo.com
Code:
#0 src/XF/CustomField/Definition.php(334): XF::handlePhpError(2, '[E_WARNING] Arr...', '<redactedpath>', 334)
#1 src/XF/CustomField/Definition.php(320): XF\CustomField\Definition->_validateFieldTypeMultiselect(Array, NULL, NULL)
#2 src/XF/CustomField/Definition.php(244): XF\CustomField\Definition->_validateFieldTypeCheckbox(Array, NULL, NULL)
#3 src/XF/CustomField/Set.php(204): XF\CustomField\Definition->isValid(Array, NULL, NULL)
#4 src/XF/CustomField/Set.php(110): XF\CustomField\Set->set('fh_marketplace_...', Array, 'user', false)
#5 src/XF/Service/Thread/CreatorService.php(445): XF\CustomField\Set->bulkSet(Array, Array, 'user')
#6 src/XF/Pub/Controller/ForumController.php(743): XF\Service\Thread\CreatorService->setCustomFields(Array)
#7 src/XF/Pub/Controller/ForumController.php(920): XF\Pub\Controller\ForumController->setupThreadCreate(Object(XF\Entity\Forum))
#8 src/XF/Mvc/Dispatcher.php(362): XF\Pub\Controller\ForumController->actionPostThread(Object(XF\Mvc\ParameterBag))
#9 src/XF/Mvc/Dispatcher.php(264): XF\Mvc\Dispatcher->dispatchClass('XF:Forum', 'PostThread', Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\ForumController), NULL)
#10 src/XF/Mvc/Dispatcher.php(121): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\ForumController), NULL)
#11 src/XF/Mvc/Dispatcher.php(63): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#12 src/XF/App.php(2824): XF\Mvc\Dispatcher->run()
#13 src/XF.php(814): XF\App->run()
#14 index.php(23): XF::runApp('XF\\Pub\\App')
#15 {main}

This is a general issue with custom fields

Steps to reproduce
  1. While logged in visit https://xenforo.com/community/account/account-details
  2. Use browser development tools to modify custom field Other forum software used: Invision Power Board to
    Code:
    <input type="checkbox" name="custom_fields[other_software][0][$testing]" value="1">
  3. Enable the option
  4. Submit the form
Expected Result
The invalid value is silently ignored or rejected with an appropriate error

Actual Result
500 Internal Server error
 
Back
Top Bottom