Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-20867

Invalid Argument error when creating Image field without setting (optional) validator configuration

    XMLWordPrintable

Details

    • 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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            Filipe.Dobreira-obsolete@ez.no Filipe Dobreira (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 6 hours, 30 minutes
                1d 6h 30m