Partial fix Error importing attachments from vBulletin 4

Jake B.

Well-known member
XFI: 1.0.2
XenForo: 2.0.12

Error:
Code:
[/B]
[staging@cp1 xf]# php cmd.php xf:import -vv


Starting import from vBulletin 4.x (Beta)...


- Importing... (< 1 sec, 9.2 MiB)


                                                       


  [InvalidArgumentException]                           


  Received invalid UTF-8 for string column [filename]  


                                                       





Exception trace:


() at /home/staging/xf/src/XF/Mvc/Entity/Entity.php:697


XF\Mvc\Entity\Entity->_castValueToType() at /home/staging/xf/src/XF/Mvc/Entity/Entity.php:575


XF\Mvc\Entity\Entity->set() at /home/staging/xf/src/XF/Service/Attachment/Preparer.php:34


XF\Service\Attachment\Preparer->insertDataFromFile() at /home/staging/xf/src/XF/Import/Data/Attachment.php:64


XF\Import\Data\Attachment->write() at /home/staging/xf/src/XF/Import/Data/AbstractData.php:126


XF\Import\Data\AbstractData->save() at /home/staging/xf/src/addons/XFI/Import/Importer/vBulletin.php:3853


XFI\Import\Importer\vBulletin->stepAttachments() at /home/staging/xf/src/XF/Import/Runner.php:160


XF\Import\Runner->runStep() at /home/staging/xf/src/XF/Import/Runner.php:74


XF\Import\Runner->run() at /home/staging/xf/src/XF/Cli/Command/Import.php:66


XF\Cli\Command\Import->execute() at /home/staging/xf/src/vendor/symfony/console/Command/Command.php:245


Symfony\Component\Console\Command\Command->run() at /home/staging/xf/src/vendor/symfony/console/Application.php:835


Symfony\Component\Console\Application->doRunCommand() at /home/staging/xf/src/vendor/symfony/console/Application.php:185


Symfony\Component\Console\Application->doRun() at /home/staging/xf/src/vendor/symfony/console/Application.php:117


Symfony\Component\Console\Application->run() at /home/staging/xf/src/XF/Cli/Runner.php:63


XF\Cli\Runner->run() at /home/staging/xf/cmd.php:15





                                            


  [InvalidArgumentException]                


  Received invalid UTF-8 for string column  


                                            





Exception trace:


() at /home/staging/xf/src/XF/Mvc/Entity/ValueFormatter.php:126


XF\Mvc\Entity\ValueFormatter->castValueToType() at /home/staging/xf/src/XF/Mvc/Entity/Entity.php:693


XF\Mvc\Entity\Entity->_castValueToType() at /home/staging/xf/src/XF/Mvc/Entity/Entity.php:575


XF\Mvc\Entity\Entity->set() at /home/staging/xf/src/XF/Service/Attachment/Preparer.php:34


XF\Service\Attachment\Preparer->insertDataFromFile() at /home/staging/xf/src/XF/Import/Data/Attachment.php:64


XF\Import\Data\Attachment->write() at /home/staging/xf/src/XF/Import/Data/AbstractData.php:126


XF\Import\Data\AbstractData->save() at /home/staging/xf/src/addons/XFI/Import/Importer/vBulletin.php:3853


XFI\Import\Importer\vBulletin->stepAttachments() at /home/staging/xf/src/XF/Import/Runner.php:160


XF\Import\Runner->runStep() at /home/staging/xf/src/XF/Import/Runner.php:74


XF\Import\Runner->run() at /home/staging/xf/src/XF/Cli/Command/Import.php:66


XF\Cli\Command\Import->execute() at /home/staging/xf/src/vendor/symfony/console/Command/Command.php:245


Symfony\Component\Console\Command\Command->run() at /home/staging/xf/src/vendor/symfony/console/Application.php:835


Symfony\Component\Console\Application->doRunCommand() at /home/staging/xf/src/vendor/symfony/console/Application.php:185


Symfony\Component\Console\Application->doRun() at /home/staging/xf/src/vendor/symfony/console/Application.php:117


Symfony\Component\Console\Application->run() at /home/staging/xf/src/XF/Cli/Runner.php:63


XF\Cli\Runner->run() at /home/staging/xf/cmd.php:15





xf:import

it's not giving any information on which row is failing though, so will have to do some digging to get more information, but just posting here beforehand in case it's something you've encountered before and know an easy fix :)
 
We've had a second report of this and after a while debugging it, I think it could be from two things.

First, there is a mbstring bug that was fixed in PHP 7.2.4 that could potentially give some unexpected output in some scenarios. I have added code to the core importer system for 2.1.1 that should help account for this.

The second potential cause is an old PCRE version which gives a false negative for the UTF-8 that is generated, as the results of the UTF-8 check did seem to differ on this server compared to all of the versions I ran my test script against. This particular server's PCRE was from 2012, so it's plausible.

I'm going to call this a partial fix based on the code I added and we'll see if we get any further reports.
 
Top Bottom