Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
rimas-kudelis opened this issue Jan 18, 2021 · 0 comments

Comments

@rimas-kudelis
Copy link
Contributor

rimas-kudelis commented Jan 18, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant