Fixed Data too long for column new_value

Kirby

Well-known member
Affected version
2.2.13
Code:
XF\Db\Exception: MySQL query error [1406]: Data too long for column 'new_value' at row 1 in src/XF/Db/AbstractStatement.php at line 230
XF\Db\AbstractStatement->getException() in src/XF/Db/Mysqli/Statement.php at line 198
XF\Db\Mysqli\Statement->getException() in src/XF/Db/Mysqli/Statement.php at line 79
XF\Db\Mysqli\Statement->execute() in src/XF/Db/AbstractAdapter.php at line 96
XF\Db\AbstractAdapter->query() in src/XF/Db/AbstractAdapter.php at line 220
XF\Db\AbstractAdapter->insert() in src/XF/Mvc/Entity/Entity.php at line 1516
XF\Mvc\Entity\Entity->_saveToSource() in src/XF/Mvc/Entity/Entity.php at line 1248
XF\Mvc\Entity\Entity->save() in src/XF/Repository/ChangeLog.php at line 136
XF\Repository\ChangeLog->logChanges() in src/XF/Behavior/ChangeLoggable.php at line 108
XF\Behavior\ChangeLoggable->postSave() in src/XF/Mvc/Entity/Entity.php at line 1275
XF\Mvc\Entity\Entity->save() in src/XF/Mvc/Entity/Entity.php at line 1266
XF\Mvc\Entity\Entity->save() in src/XF/Mvc/FormAction.php at line 71
XF\Mvc\FormAction->XF\Mvc\{closure}() in src/XF/Mvc/FormAction.php at line 189
XF\Mvc\FormAction->run() in src/XF/Admin/Controller/User.php at line 559
XF\Admin\Controller\User->actionSave() in src/XF/Mvc/Dispatcher.php at line 352
XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 259
XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 115
XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 57
XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2354
XF\App->run() in src/XF.php at line 524
XF::runApp() in admin.php at line 13

This happens when trying to save a custom user field (textbox) with a length of more than 65.535 bytes.
Table xf_user_field_value uses MEDIUMTEXT for field_value, but table xf_change_log only TEXT for old_value / new_value

Suggested Fix
A warning message telling the user that the entered value is too long
OR
Accept all values that could be stored in xf_user_field_value, eg. change old_value / new_value to MEDIUMTEXT as well in xf_change_log (Preferred)
 
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.14).

Change log:
Increase the size of the old_value and new_value columns in the xf_change_log table
There may be a delay before changes are rolled out to the XenForo Community.
 
Back
Top Bottom