Fixed 500 error when importing polls in IPBoard.php from IPB 3.4.6

denam

Active member
#1
I tried a test conversion from IP.Board 3.4.6 to Xenforo 1.3.3 and importing polls resulted in a 500 error.

The server error log returned the following message:

Code:
end() expects parameter 1 to be array, boolean given

Error Info
ErrorException: end() expects parameter 1 to be array, boolean given - library/XenForo/Importer/IPBoard.php:3020
Generated By: user, 1 minute ago
Stack Trace
#0 [internal function]: XenForo_Application::handlePhpError(2, 'end() expects p...', '/var/www/client...', 3020, Array)
#1 /var/www/clients/client0/web1/web/xen/library/XenForo/Importer/IPBoard.php(3020): end(false)
#2 /var/www/clients/client0/web1/web/xen/library/XenForo/Importer/Abstract.php(97): XenForo_Importer_IPBoard->stepPolls(0, Array)
#3 /var/www/clients/client0/web1/web/xen/library/XenForo/ControllerAdmin/Import.php(187): XenForo_Importer_Abstract->runStep(Object(XenForo_ControllerAdmin_Import), Object(XenForo_ImportSession), 'polls', 0, Array)
#4 /var/www/clients/client0/web1/web/xen/library/XenForo/ControllerAdmin/Import.php(239): XenForo_ControllerAdmin_Import->_runStep(Object(XenForo_Importer_IPBoard34x), Object(XenForo_ImportSession), 'polls', 0, Array)
#5 /var/www/clients/client0/web1/web/xen/library/XenForo/ControllerAdmin/Import.php(182): XenForo_ControllerAdmin_Import->_startStep(Object(XenForo_Importer_IPBoard34x), Object(XenForo_ImportSession), 'polls', Array)
#6 /var/www/clients/client0/web1/web/xen/library/XenForo/FrontController.php(347): XenForo_ControllerAdmin_Import->actionStartStep()
#7 /var/www/clients/client0/web1/web/xen/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#8 /var/www/clients/client0/web1/web/xen/admin.php(13): XenForo_FrontController->run()
#9 {main}
Request State
array(3) {
  ["url"] => string(49) "http://wiitel.com/xen/admin.php?import/start-step"
  ["_GET"] => array(1) {
    ["import/start-step"] => string(0) ""
  }
  ["_POST"] => array(3) {
    ["options"] => array(1) {
      ["whichQuestion"] => string(4) "last"
    }
    ["step"] => string(5) "polls"
    ["_xfToken"] => string(8) "********"
  }
}
 

Mike

XenForo developer
Staff member
#2
I'm probably just going to have to suppress an unserialize failure here (and I've just added code to do that), but can you see if there are any other errors? I suspect it will complain about a failed unserialize?
 

denam

Active member
#3
There is also this message which seems to to show the same error message
Code:
reset() expects parameter 1 to be array, boolean given
Server Error Log
Error Info
ErrorException: reset() expects parameter 1 to be array, boolean given - library/XenForo/Importer/IPBoard.php:3020
Generated By: user, Wednesday at 9:51 AM
Stack Trace
#0 [internal function]: XenForo_Application::handlePhpError(2, 'reset() expects...', '/var/www/client...', 3020, Array)
#1 /var/www/clients/client0/web1/web/xen/library/XenForo/Importer/IPBoard.php(3020): reset(false)
#2 /var/www/clients/client0/web1/web/xen/library/XenForo/Importer/Abstract.php(97): XenForo_Importer_IPBoard->stepPolls(0, Array)
#3 /var/www/clients/client0/web1/web/xen/library/XenForo/ControllerAdmin/Import.php(187): XenForo_Importer_Abstract->runStep(Object(XenForo_ControllerAdmin_Import), Object(XenForo_ImportSession), 'polls', 0, Array)
#4 /var/www/clients/client0/web1/web/xen/library/XenForo/ControllerAdmin/Import.php(239): XenForo_ControllerAdmin_Import->_runStep(Object(XenForo_Importer_IPBoard34x), Object(XenForo_ImportSession), 'polls', 0, Array)
#5 /var/www/clients/client0/web1/web/xen/library/XenForo/ControllerAdmin/Import.php(182): XenForo_ControllerAdmin_Import->_startStep(Object(XenForo_Importer_IPBoard34x), Object(XenForo_ImportSession), 'polls', Array)
#6 /var/www/clients/client0/web1/web/xen/library/XenForo/FrontController.php(347): XenForo_ControllerAdmin_Import->actionStartStep()
#7 /var/www/clients/client0/web1/web/xen/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#8 /var/www/clients/client0/web1/web/xen/admin.php(13): XenForo_FrontController->run()
#9 {main}
Request State
array(3) {
  ["url"] => string(49) "http://wiitel.com/xen/admin.php?import/start-step"
  ["_GET"] => array(1) {
    ["import/start-step"] => string(0) ""
  }
  ["_POST"] => array(3) {
    ["options"] => array(1) {
      ["whichQuestion"] => string(5) "first"
    }
    ["step"] => string(5) "polls"
    ["_xfToken"] => string(8) "********"
  }
}
I am not sure where to look at besides the "Server Error Logs" in the Xenforo Admin section.
 

Attachments

Mike

XenForo developer
Staff member
#4
I guess the highlighted code just needs to be added to library/XenForo/Importer/IPBoard.php:
Rich (BB code):
                           $answers = unserialize(stripslashes($voter['member_choices']));
                           if (!$answers)
                           {
                               continue;
                           }
 
Top