Potential for recursion in EntityReferenceItem::generateSampleValue() with circular entity references

Created on 27 December 2019, over 4 years ago
Updated 12 January 2024, 8 months ago

Problem/Motivation

Over in #2966137: Circular entity references cause infinite loop in EntityReferenceItem::generateSampleValue() β†’ some prevention of cyclic entity references recursing forever was added. However, under certain conditions, this logic:

      // Remove the indicator once the entity is successfully generated.
      unset($recursion_tracker[$key]);

still allows for infinite recursion. I've found this in concert with both the Entity Reference Revision and Layout Builder Restrictions enabled on a site with dozens of entity reference fields.

Removing the logic where the recursion tracker is unset resolves the issue.

Proposed resolution

Figure out a test and write that to demonstrate the issue, and remove the unsetting of the recursion tracker.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
Entity referenceΒ  β†’

Last updated 15 days ago

No maintainer
Created by

πŸ‡ΊπŸ‡ΈUnited States jhedstrom Portland, OR

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States madhaze

    #2 patch worked for the issue I was seeing.
    Fixed recursion happening on content type "Manage Display" for view modes using Layout Builder Restrictions. As well as the "Manage Layout" edit page.

Production build 0.71.5 2024