Security update for Core, with self-updated composer
[yaffs-website] / web / core / lib / Drupal / Core / Field / FieldItemList.php
index a1a1ebdb9ebb12c02e3789471d6de1becb1c79ac..c2e9ada44c5e0a300729dd539f2c31ea1eca2cb9 100644 (file)
@@ -7,6 +7,7 @@ use Drupal\Core\Entity\FieldableEntityInterface;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\Core\Session\AccountInterface;
+use Drupal\Core\TypedData\DataDefinitionInterface;
 use Drupal\Core\TypedData\Plugin\DataType\ItemList;
 
 /**
@@ -378,7 +379,6 @@ class FieldItemList extends ItemList implements FieldItemListInterface {
    * {@inheritdoc}
    */
   public function equals(FieldItemListInterface $list_to_compare) {
-    $columns = $this->getFieldDefinition()->getFieldStorageDefinition()->getColumns();
     $count1 = count($this);
     $count2 = count($list_to_compare);
     if ($count1 === 0 && $count2 === 0) {
@@ -396,9 +396,13 @@ class FieldItemList extends ItemList implements FieldItemListInterface {
     }
     // If the values are not equal ensure a consistent order of field item
     // properties and remove properties which will not be saved.
-    $callback = function (&$value) use ($columns) {
+    $property_definitions = $this->getFieldDefinition()->getFieldStorageDefinition()->getPropertyDefinitions();
+    $non_computed_properties = array_filter($property_definitions, function (DataDefinitionInterface $property) {
+      return !$property->isComputed();
+    });
+    $callback = function (&$value) use ($non_computed_properties) {
       if (is_array($value)) {
-        $value = array_intersect_key($value, $columns);
+        $value = array_intersect_key($value, $non_computed_properties);
         ksort($value);
       }
     };