Fixed  Import problem: Out of range value adjusted for column 'attach_count' at row 1

dutchbb

Well-known member
I was almost done with the first test import, this happened during the import of attachments, it keeps showing when I return to the import page.
Code:
Server Error

Mysqli statement execute error : Out of range value adjusted for column 'attach_count' at row 1

Zend_Db_Statement_Mysqli->_execute() in Zend/Db/Statement.php at line 297
Zend_Db_Statement->execute() in Zend/Db/Adapter/Abstract.php at line 479
Zend_Db_Adapter_Abstract->query() in XenForo/Model/Import.php at line 1023
XenForo_Model_Import->importPostAttachment() in XenForo/Importer/vBulletin.php at line 2089
XenForo_Importer_vBulletin->stepAttachments() in XenForo/Importer/Abstract.php at line 77
XenForo_Importer_Abstract->runStep() in XenForo/ControllerAdmin/Import.php at line 161
XenForo_ControllerAdmin_Import->_runStep() in XenForo/ControllerAdmin/Import.php at line 105
XenForo_ControllerAdmin_Import->actionImport() in XenForo/FrontController.php at line 310
XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 132
XenForo_FrontController->run() in /home/xxxx/domains/mydomain.com/public_html/xxxx/admin.php at line 13
 
The counter in vB was probably wrong, or you have 65000 attachments to one post. :)

I actually found 2 minor bugs here - the attach count code in the import is wrong.

In library/XenForo/Importer/vBulletin.php, you should change:
Code:
'attach_count' => $post['attach'],
to
Code:
'attach_count' => 0,

Then in library/XenForo/Model/Import.php, change:
Code:
attach_count = attach_count + 1
to:
Code:
attach_count = IF(attach_count < 65535, attach_count + 1, 65535)

The second change will prevent this error. The only way for the counts to be right (and there was a bug in XF that caused them to be wrong before as well) is to do a fresh import.
 
Top Bottom