Commit 5dc271dd authored by catch's avatar catch
Browse files

fix: #3557579...

fix: #3557579 Drupal\jsonapi\Normalizer\FieldItemNormalizer->checkForSerializedStrings()() (Line: 32) triggers deprecations on PHP 8.5

By: @alexpott
(cherry picked from commit ac99525a)
parent 2584738b
Loading
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -92,6 +92,13 @@ public function denormalize($data, $class, $format = NULL, array $context = []):
    $item_definition = $context['field_definition']->getItemDefinition();
    assert($item_definition instanceof FieldItemDataDefinitionInterface);

    // The NULL normalization means there is no value, hence we can return
    // early. Note that this is not just an optimization but a necessity for
    // field types without main properties (such as the "map" field type).
    if ($data === NULL) {
      return $data;
    }

    $field_item = $this->getFieldItemInstance($context['resource_type'], $item_definition);
    $this->checkForSerializedStrings($data, $class, $field_item);

@@ -113,12 +120,6 @@ public function denormalize($data, $class, $format = NULL, array $context = []):
    // be expanded to an array of all properties, we special-case single-value
    // properties.
    if (!is_array($data)) {
      // The NULL normalization means there is no value, hence we can return
      // early. Note that this is not just an optimization but a necessity for
      // field types without main properties (such as the "map" field type).
      if ($data === NULL) {
        return $data;
      }
      $property_value = $data;
      $property_name = $item_definition->getMainPropertyName();
      $property_value_class = $property_definitions[$property_name]->getClass();