Skip to content

IBX-11610: Images with width="" or height="" in xml definition will cause crash#745

Open
vidarl wants to merge 1 commit intomainfrom
IBX-11610_Images_with_width_or_height_as_empty_string_in_xml_definition_will_cause_crash
Open

IBX-11610: Images with width="" or height="" in xml definition will cause crash#745
vidarl wants to merge 1 commit intomainfrom
IBX-11610_Images_with_width_or_height_as_empty_string_in_xml_definition_will_cause_crash

Conversation

@vidarl
Copy link
Copy Markdown
Contributor

@vidarl vidarl commented Apr 15, 2026

🎫 Issue IBX-11610

Description:

In 5.0, strict typing was added to width and height in ImageVariation.php. (It was not added to Image\Value.php though)

I am not able to reproduce this on a fresh 5.0 database, but if you have upgraded from older version, you might have width and/or height set to empty value ””, ie:

<?xml version="1.0" encoding="UTF-8"?>
<ezimage serial_number="1" is_valid="1" filename="300bb9aadf95-vbanner.jpg" suffix="jpg" basename="300bb9aadf95-vbanner" dirpath="var/site/storage/images/6/5/5/3/3556-1-eng-GB" url="var/site/storage/images/6/5/5/3/3556-1-eng-GB/300bb9aadf95-vbanner.jpg" original_filename="300bb9aadf95-vbanner.jpg" mime_type="image/jpeg" width="" height="" alternative_text="" alias_key="1293033771" timestamp="1775563557">
   <original attribute_id="3556" attribute_version="1" attribute_language="eng-GB" />
   <information Height="150" Width="450" IsColor="1" />
   <additional_data />
</ezimage>

If you then try to load this image in admin-ui, it wlll crash due do violation of strict typing:

An exception has been thrown during the rendering of a template ("Cannot assign string to property Ibexa\Contracts\Core\Variation\Values\ImageVariation::$width of type ?int") in "@IbexaAdminUi/themes/admin/ui/field_type/preview/content_fields.html.twig".
image

For QA:

See my comment from Apr 07, 2026 12:17 on https://support.ibexa.co/tickets/view/ISD-26496

Documentation:

@sonarqubecloud
Copy link
Copy Markdown

? $fieldValue->data['imageId']
: null),
'width' => (isset($fieldValue->data['width'])
'width' => ($fieldValue->data['width'] ?? '') !== ''
Copy link
Copy Markdown
Contributor Author

@vidarl vidarl Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to be the most convenient place to do this check, but is this the correct place to add it?
Alternatives are:

@vidarl vidarl requested a review from a team April 15, 2026 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants