Skip to content

Commit

Permalink
Issue #3142893 by hchonov, Raunak.singh, kishor_kolekar, alexpott, ts…
Browse files Browse the repository at this point in the history
…toeckler, catch, kfritsche, johnwebdev: Memory leak - typed data prototypes for field items are not re-used like intended

(cherry picked from commit ce5d85281b53bb683c6e0c9cdd27a14368584091)
  • Loading branch information
catch committed Jul 10, 2020
1 parent 4b62382 commit a13dc2a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/Drupal/Core/TypedData/TypedDataManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,15 @@ public function getPropertyInstance(TypedDataInterface $object, $property_name,
$parts[] = json_encode($settings);
}
// Property path for the requested data object.
$parts[] = $object->getPropertyPath() . '.' . $property_name;
$parts[] = $object->getPropertyPath();
// Only property instances of complex data types should be cached by the
// property name, as they represent different properties. Properties of list
// data types are the items of the list and the property name represents
// only the delta in that list and not an unique property, which is why all
// items should use the same prototype.
if ($object instanceof ComplexDataInterface) {
$parts[] = $property_name;
}
$key = implode(':', $parts);

// Create the prototype if needed.
Expand Down

0 comments on commit a13dc2a

Please sign in to comment.