From de1c6dddc0e64f25d4161c3786b4dc505b8fd7b0 Mon Sep 17 00:00:00 2001 From: Thiago Campos Viana Date: Thu, 21 Nov 2024 18:49:36 -0300 Subject: [PATCH] Preventing Fatal error in PHP 8 for ezobjectrelationlist datatype when data_text is an empty string or null We want to standardize the data_text default value to an empty string because in PHP 8 most of operations with string will throw a Fatal error when passing null. The data_text value is initialized with a null value when adding a new attribute to an existing content class. --- .../Content/FieldValue/Converter/RelationListConverter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/RelationListConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/RelationListConverter.php index 9a3dc4a568..f357452cd2 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/RelationListConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/RelationListConverter.php @@ -86,7 +86,7 @@ public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue) $priorityByContentId = []; $dom = new DOMDocument('1.0', 'utf-8'); - if ($dom->loadXML($value->dataText) === true) { + if ($value->dataText != "" && $dom->loadXML($value->dataText) === true) { foreach ($dom->getElementsByTagName('relation-item') as $relationItem) { /* @var \DOMElement $relationItem */ $priorityByContentId[$relationItem->getAttribute('contentobject-id')] =