Skip to content

fix: stop infinite recursion on objects with reference cycles - #21

Merged
roxblnfk merged 2 commits into
1.xfrom
fix/fallback-cycles
Oct 9, 2026
Merged

roxblnfk merged 2 commits into
1.xfrom
fix/fallback-cycles

Conversation

@roxblnfk

@roxblnfk roxblnfk commented Oct 9, 2026

Copy link
Copy Markdown
Member

What was changed

  • FallbackProcessor no longer recurses forever on objects with reference cycles. Before, an object with a property pointing to itself exhausted memory: the self-reference was removed from the result but still passed to the processor.
  • FallbackProcessor keeps track of the objects it is exporting:
    • a property that points to the object itself or to an object that contains it (A → B → A) is left out, as the self-reference was meant to be;
    • an object reached again through an array or another processor is exported as ['@class' => …] only;
    • an object shared by several properties without a cycle is still exported in full in each place.
  • No public API changes: FallbackProcessor only gains a parameterless constructor. README documents how cycles are handled.

Checklist

  • Tested
    • Unit tests added; the previously skipped test passes
    • Testo, psalm, cs:diff and Infection (MSI 96%) run locally on PHP 8.4

The processor tracks the objects whose export is in progress, so cycles through properties, arrays or other processors terminate instead of exhausting memory.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
@roxblnfk
roxblnfk requested a review from a team October 9, 2026 20:22
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 160c9876-eb06-4737-90d0-045844990b0c

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@roxblnfk
roxblnfk merged commit 36788d4 into 1.x Oct 9, 2026
15 checks passed
@roxblnfk
roxblnfk deleted the fix/fallback-cycles branch October 9, 2026 20:25
@github-actions github-actions Bot mentioned this pull request Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant