Skip to content

Commit

Permalink
Preventing Fatal error in PHP 8 for ezobjectrelationlist datatype whe…
Browse files Browse the repository at this point in the history
…n 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.
  • Loading branch information
Thiago Campos Viana committed Nov 21, 2024
1 parent 4c9295f commit de1c6dd
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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')] =
Expand Down

0 comments on commit de1c6dd

Please sign in to comment.