FriendsOfSylius/SyliusImportExportPlugin

ResourceImporter::import() calls importData() with a potentially invalid argument

Opened this issue · 0 comments

This foreach cycle calls $this->importData() without first making sure that the second argument passed ($row) is an array, as typehinted by importData(). Apparently, somethings the reader might return a non-array (null in our case), in which case the whole import fails with the following exception:

ResourceImporter::importData() must be of the type array, null given, called in /var/www/vendor/friendsofsylius/sylius-import-export-plugin/src/Importer/ResourceImporter.php on line 64.

A simple fix is to either check that $row is an array first, or to accept a non-array argument in importData() and trigger an exception there.

I'm thinking it might also be a good idea to catch all throwables there, but that's probably a topic for another discussion.