Error when importing IPS4 polls

K a M a L

Well-known member
Affected version
1.5.1
I got this error with latest two IPS imports I did
Code:
ErrorException: [E_WARNING] end() expects parameter 1 to be array, bool given , src/addons/XFI/Import/Importer/IpsForums.php:1914
Code:
Stack trace

#0 [internal function]: XF::handlePhpError(2, '[E_WARNING] end...', '/var/www...', 1914, Array)
#1 src/addons/XFI/Import/Importer/IpsForums.php(1914): end(false)
#2 src/XF/Import/Runner.php(244): XFI\Import\Importer\IpsForums->stepPolls(Object(XF\Import\StepState), Array, 8)
#3 src/XF/Import/Runner.php(61): XF\Import\Runner->runStep('polls', Object(XF\Import\StepState), 8)
#4 src/XF/Admin/Controller/Import.php(234): XF\Import\Runner->run()
#5 src/XF/Mvc/Dispatcher.php(352): XF\Admin\Controller\Import->actionRun(Object(XF\Mvc\ParameterBag))
#6 src/XF/Mvc/Dispatcher.php(259): XF\Mvc\Dispatcher->dispatchClass('XF:Import', 'Run', Object(XF\Mvc\RouteMatch), Object(XF\Admin\Controller\Import), NULL)
#7 src/XF/Mvc/Dispatcher.php(115): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Admin\Controller\Import), NULL)
#8 src/XF/Mvc/Dispatcher.php(57): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#9 src/XF/App.php(2351): XF\Mvc\Dispatcher->run()
#10 src/XF.php(517): XF\App->run()
#11 admin.php(13): XF::runApp('XF\\Admin\\App')
#12 {main}

I didn't want to spend time debugging it and just went with
Code:
if(!is_array($questions)){
    continue;
}
but I think something needs to be fixed there
 
I also received this today:

ErrorException: [E_WARNING] end() expects parameter 1 to be array, bool given in src/addons/XFI/Import/Importer/IpsForums.php at line 1914
  1. XF::handlePhpError()
  2. end() in src/addons/XFI/Import/Importer/IpsForums.php at line 1914
  3. XFI\Import\Importer\IpsForums->stepPolls() insrc/XF/Import/Runner.php at line 244
  4. XF\Import\Runner->runStep() in src/XF/Import/Runner.php at line 61
  5. XF\Import\Runner->run() in src/XF/Admin/Controller/Import.php at line234
  6. XF\Admin\Controller\Import->actionRun() in src/XF/Mvc/Dispatcher.phpat line 352
  7. XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 259
  8. XF\Mvc\Dispatcher->dispatchFromMatch() insrc/XF/Mvc/Dispatcher.php at line 115
  9. XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 57
  10. XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2351
  11. XF\App->run() in src/XF.php at line 517
  12. XF::runApp() in admin.php at line 13
 
Thanks for posting. I also hit it this on a test migration.

If I can figure out the source error, fix the data... or just apply @k-a-m-a-l's patch

Code:
Server error log

    ErrorException: [E_WARNING] end() expects parameter 1 to be array, bool given src/addons/XFI/Import/Importer/IpsForums.php:1914

    Generated by: Unknown account Jul 31, 2022 at 4:12 PM

Stack trace

#0 [internal function]: XF::handlePhpError(2, '[E_WARNING] end...', '/home/nginx/dom...', 1914, Array)
#1 src/addons/XFI/Import/Importer/IpsForums.php(1914): end(false)
#2 src/XF/Import/Runner.php(244): XFI\Import\Importer\IpsForums->stepPolls(Object(XF\Import\StepState), Array, 8)
#3 src/XF/Import/ParallelRunner.php(213): XF\Import\Runner->runStep('polls', Object(XF\Import\StepState), 8)
#4 src/XF/Cli/Command/ImportChildProcess.php(77): XF\Import\ParallelRunner->runChildProcess('polls', 1473, 1964, Object(Closure))
#5 src/vendor/symfony/console/Command/Command.php(255): XF\Cli\Command\ImportChildProcess->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 src/vendor/symfony/console/Application.php(992): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 src/vendor/symfony/console/Application.php(255): Symfony\Component\Console\Application->doRunCommand(Object(XF\Cli\Command\ImportChildProcess), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 src/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 src/XF/Cli/Runner.php(111): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 cmd.php(15): XF\Cli\Runner->run()
#11 {main}

Request state

array(1) {
  ["cli"] => string(87) "<path>/cmd.php xf:import-child-process polls 1473 1964"
}

As this is purely an exploratory migration to gauge timings, I went with a quick data update... I do not know what impact this will have, ids noted. Check this on a backup/test.

Code:
SELECT poll.pid, topic.tid, topic.title_seo FROM core_polls AS poll INNER JOIN forums_topics AS topic ON (topic.poll_state = poll.pid)                     WHERE poll.choices='false' ORDER BY poll.pid;

# mk1 eyeball checks...
update core_polls set choices='{"1":{"question":"ReplacedPoll","multi":0,"choice":{"1":"Yes","2":"No"},"votes":{"1":0,"2":0}}}' where choices='false';

For reference, this is an old topic poll, that had a 'false' value. It's an old one, maybe even phpbb, if not that vb, and has gone through at least one migration into IPB and now to XF :) Looks like the actual poll is long since gone, the starter is not the first post, so some other history has happened too.

I reckon I'd be fairly safe to drop those polls rows. If not setting the values above.
 
Last edited:
Back
Top Bottom