3614889 - Fix default-sentinel collision and shared-entity mutation in ERFO

The 'default' string was overloaded as both the sentinel meaning "no override, use the base value" and a legitimate allowed_values key on real fields (e.g. field_feature_style defines an option literally keyed 'default'). Selecting that real value was indistinguishable from "no override" and got silently discarded. Separately, both the base module's preprocess and the erfo_paragraphs preprocess functions were mutating the referenced entity or paragraph object in place before applying overrides -- but Drupal's entity static cache returns the same PHP object for every load of a given entity ID within a request, so an override applied to one placement leaked into every other placement (including reusable library paragraphs) referencing that same entity in the same request.

Change log:

  • Added ENTITY_REFERENCE_FIELD_OVERRIDE_DEFAULT_SENTINEL ('_erfo_default') constant in entity_reference_field_override.module and replaced all uses of the collision-prone 'default' string sentinel across the base module, EntityReferenceFieldOverrideHooks.php, erfo_paragraphs.module, and ErfoParagraphsHooks.php
  • Fixed entity_reference_field_override_preprocess in entity_reference_field_override.module to clone the referenced node, paragraph, or media entity before applying field overrides, preventing cross-placement mutation of shared static-cache entity objects
  • Fixed _erfo_paragraphs_preprocess_regular in erfo_paragraphs.module to clone the paragraph before setting override values
  • Fixed the from_library override path in erfo_paragraphs.module to clone the inner reusable library paragraph before mutating it, preventing overrides from leaking across every placement of the same library item

Merge request reports

Loading
Loading