Fixed User upgrades error

Tom

Active member
Affected version
2.0.1
When attempting to manually upgrade more than one user to a single user upgrade, I get the following error:

Code:
XF\Db\DuplicateKeyException: MySQL query error [1062]: Duplicate entry '7' for key 'PRIMARY' in src/XF/Db/AbstractStatement.php at line 212
XF\Db\AbstractStatement->getException() in src/XF/Db/Mysqli/Statement.php at line 174
XF\Db\Mysqli\Statement->getException() in src/XF/Db/Mysqli/Statement.php at line 70
XF\Db\Mysqli\Statement->execute() in src/XF/Db/AbstractAdapter.php at line 74
XF\Db\AbstractAdapter->query() in src/XF/Db/AbstractAdapter.php at line 235
XF\Db\AbstractAdapter->update() in src/XF/Mvc/Entity/Entity.php at line 1217
XF\Mvc\Entity\Entity->fastUpdate() in src/XF/Entity/UserUpgradeActive.php at line 39
XF\Entity\UserUpgradeActive->_postSave() in src/XF/Mvc/Entity/Entity.php at line 1137
XF\Mvc\Entity\Entity->save() in src/XF/Service/User/Upgrade.php at line 170
XF\Service\User\Upgrade->upgrade() in src/XF/Admin/Controller/UserUpgrade.php at line 167
XF\Admin\Controller\UserUpgrade->actionManual() in src/XF/Mvc/Dispatcher.php at line 249
XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 89
XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 41
XF\Mvc\Dispatcher->run() in src/XF/App.php at line 1880
XF\App->run() in src/XF.php at line 328
XF::runApp() in admin.php at line 13
 
This is fixed for 2.0.2. It's caused by a somewhat odd decision within InnoDB that doesn't change auto_increment counters if the primary key ever gets updated, potentially leading to a duplicate key error (which in some cases, may be get resolved over time).
 
Back
Top Bottom