Uploaded image for project: 'eZ Platform Enterprise Edition'
  1. eZ Platform Enterprise Edition
  2. EZEE-3347

ImageAsset comparision throws exception if destinationContentId value is string

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: High High
    • 3.1.5, 3.3.0-beta1, 3.2.2
    • 3.2.0, 3.1.4
    • None
    • None

    Description

      Steps to reproduce

      Create a content object using migrations. Set ImageAsset Field's destinationContentId value to string, for instance "94".

      Modify the new content object using AdminUI.

      Try to run inline version compare (Side-by-side works fine).

      Result

      The following exception is thrown:

      Argument 2 passed to
       
      EzSystems\EzPlatformVersionComparison\Result\Value\Diff\IntegerDiff::__construct()
       must be of the type int or null, string given, called in... 

      Stacktrace:

      Argument 2 passed to EzSystems\EzPlatformVersionComparison\Result\Value\Diff\IntegerDiff::__construct() must be of the type int or null, string given, called in .../vendor/ezsystems/ezplatform-version-comparison/src/lib/Engine/Value/IntegerComparisonEngine.php on line 32  at vendor/ezsystems/ezplatform-version-comparison/src/lib/Result/Value/Diff/IntegerDiff.php:16
        at EzSystems\EzPlatformVersionComparison\Result\Value\Diff\IntegerDiff->__construct('removed', '94')
           (vendor/ezsystems/ezplatform-version-comparison/src/lib/Engine/Value/IntegerComparisonEngine.php:32)
        at EzSystems\EzPlatformVersionComparison\Engine\Value\IntegerComparisonEngine->compareValues(object(IntegerComparisonValue), object(IntegerComparisonValue))
           (vendor/ezsystems/ezplatform-version-comparison/src/lib/Engine/FieldType/ImageAssetComparisonEngine.php:59)
        at EzSystems\EzPlatformVersionComparison\Engine\FieldType\ImageAssetComparisonEngine->compareFieldsTypeValues(object(Value), object(Value))
           (vendor/ezsystems/ezplatform-version-comparison/src/lib/Service/VersionComparisonService.php:110)
        at EzSystems\EzPlatformVersionComparison\Service\VersionComparisonService->compare(object(VersionInfo), object(VersionInfo), 'eng-GB')
           (vendor/ezsystems/ezplatform-version-comparison/src/bundle/Controller/VersionComparisonController.php:120)
        at EzSystems\EzPlatformVersionComparisonBundle\Controller\VersionComparisonController->compareAction(object(ContentInfo), 1, 2)
           (vendor/symfony/http-kernel/HttpKernel.php:157)
        at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
           (vendor/symfony/http-kernel/HttpKernel.php:79)
        at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
           (vendor/symfony/http-kernel/Kernel.php:196)
        at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
           (public/index.php:42)    

      Expected result

      Version compare works fine.

      Context

      The problem has been experienced in the demo that uses migrations for content creation. Underlying issue is that ImageAsset FieldType allows to store destinationContentId value as both string or integer.

      Since this kind of "corrupt" data entries might already exist in different projects it still seems to be reasonable to fix it in the ezsystems/ezplatform-version-comparison package.

      Attachments

        Activity

          People

            Unassigned Unassigned
            kamil.madejski@ibexa.co Kamil Madejski
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: