Fixed vBulletin: Error when importing thread prefixes

Kirby

Well-known member
Affected version
1.1.0
Code:
InvalidArgumentException: Attempted to convert NULL to string/binary [phrase_text] src/XF/Mvc/Entity/Entity.php:740
Generated by: Unknown account Feb 11, 2019 at 7:20 PM
Stack trace
#0 src/XF/Mvc/Entity/Entity.php(618): XF\Mvc\Entity\Entity->_castValueToType(NULL, 'phrase_text', 5, Array)
#1 src/XF/Mvc/Entity/Entity.php(548): XF\Mvc\Entity\Entity->set('phrase_text', NULL)
#2 src/XF/Import/Data/AbstractData.php(240): XF\Mvc\Entity\Entity->__set('phrase_text', NULL)
#3 src/XF/Import/Data/ThreadPrefixGroup.php(30): XF\Import\Data\AbstractData->insertMasterPhrase('thread_prefix_g...', NULL)
#4 src/XF/Import/Data/AbstractData.php(135): XF\Import\Data\ThreadPrefixGroup->postSave('ff_notify_post_...', 2)
#5 src/addons/XFI/Import/Importer/vBulletin.php(2764): XF\Import\Data\AbstractData->save('ff_notify_post_...')
#6 src/XF/Import/Runner.php(160): XFI\Import\Importer\vBulletin->stepThreadPrefixes(Object(XF\Import\StepState), Array, 8)
#7 src/XF/Import/Runner.php(74): XF\Import\Runner->runStep('threadPrefixes', Object(XF\Import\StepState), 8)
#8 src/XF/Cli/Command/Import.php(66): XF\Import\Runner->run()
#9 src/vendor/symfony/console/Command/Command.php(255): XF\Cli\Command\Import->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 src/vendor/symfony/console/Application.php(953): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 src/vendor/symfony/console/Application.php(248): Symfony\Component\Console\Application->doRunCommand(Object(XF\Cli\Command\Import), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 src/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 src/XF/Cli/Runner.php(63): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 cmd.php(15): XF\Cli\Runner->run()
#15 {main}

This apparently happened because the prefix category title was empty in the source DB and the phrase did not exist (should not be possible, but it was).

As a fix, I've added a (string) cast for both prefix group and prefix title.
 
Thank you for reporting this issue. It has now been resolved and we are aiming to include it in a future XF release (2.1.2).

Change log:
Cast imported master phrase texts to string by default.
Any changes made as a result of this issue being resolved may not be rolled out here until later.
 
Top Bottom