Skip to content
New issue

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

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

Already on GitHub? # to your account

Number::normalizeValue can throw an exception when an ElementInterface is not included #2913

Closed
spleenboy opened this issue May 22, 2018 · 1 comment

Comments

@spleenboy
Copy link

The Field::normalizeValue method has an optional 2nd parameter: ElementInterface, but the Number field's override of normalizeValue calls the isValueEmpty method, which requires an ElementInterface, which can resul in a TypeError like the following:

TypeError: Argument 2 passed to craft\base\Field::isValueEmpty() must implement interface craft\base\ElementInterface, null given, called in /usr/share/nginx/craft/vendor/craftcms/cms/src/fields/Number.php on line 152 and defined in /usr/share/nginx/craft/vendor/craftcms/cms/src/base/Field.php:311
Stack trace:
#0 /usr/share/nginx/craft/vendor/craftcms/cms/src/fields/Number.php(152): craft\base\Field->isValueEmpty('24670.00', NULL)
#1 /packages/craft-csv-import/src/importers/ElementImporter.php(182): craft\fields\Number->normalizeValue('24670.00')
...
@brandonkelly
Copy link
Member

Thanks for reporting!

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

No branches or pull requests

2 participants