From 045cb9e6034159148c27bb400a33c3ef4728a192 Mon Sep 17 00:00:00 2001 From: Konrad Oboza Date: Mon, 22 Apr 2024 13:04:32 +0200 Subject: [PATCH] IBX-8032: Added proper casting to int for width/height in image search field (#354) For more details see https://issues.ibexa.co/browse/IBX-8032 and https://github.com/ibexa/core/pull/354 --- src/lib/FieldType/Image/SearchField.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/lib/FieldType/Image/SearchField.php b/src/lib/FieldType/Image/SearchField.php index 7ec05df1bd..cce5068a1e 100644 --- a/src/lib/FieldType/Image/SearchField.php +++ b/src/lib/FieldType/Image/SearchField.php @@ -18,8 +18,13 @@ class SearchField implements Indexable { public function getIndexData(Field $field, FieldDefinition $fieldDefinition) { - $width = $field->value->data['width'] ?? null; - $height = $field->value->data['height'] ?? null; + $width = isset($field->value->data['width']) && $field->value->data['width'] !== null + ? (int)$field->value->data['width'] + : null; + + $height = isset($field->value->data['height']) && $field->value->data['height'] !== null + ? (int)$field->value->data['height'] + : null; return [ new Search\Field(