Details
-
Bug
-
Resolution: Fixed
-
High
-
5.0, 5.1
-
PHP 5.3.3
RHEL 6.3
-
Aconcagua Sprint 1
Description
Through REST v2 (and likely the PAPI aswell), creating a ContentType with an Image FieldType, and omitting the validator configurations on it (since they are optional, as seen here) will cause an error:
Warning: Invalid argument supplied for foreach()
in .../ezp5/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/FieldType/Image/Type.php
line 228
Looking at the code, I tracked the error through the following files:
1. Core/Repository/ContentTypeService:581; in a situation where the configurations are not passed through the REST request, $fieldDefinitionCreateStruct->validatorConfiguration is NULL.
2. Core/FieldType/Image/Type.php:224 attempts to iterate through this. Since the argument is NULL, an error is thrown.
This issue may be present in other places. An example of a place where it WAS considered is Core/FieldType/TextLine/Type:45, where the argument is cast to an array in the iteration.