Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relation with recursive reference causes infinite loop (even if it's not in the data) #787

Closed
Tofandel opened this issue Jun 5, 2024 · 1 comment

Comments

@Tofandel
Copy link
Contributor

Tofandel commented Jun 5, 2024

✏️ Describe the bug
Transforming a model in which there is a relation in which another relation points to itself will result in an infinite loop

↪️ To Reproduce
Provide us a pest test like this one which shows the problem:

it('does not loop infinitely on relations', function () {
    $m1 = new FakeModel();
    $m2 = new FakeNestedModel();
    $m2->setRelation('parent', $m1);
    $m1->setRelation('pivot', $m2);

    FakeModelData::from($m1); //Infinite loop
});
@rubenvanassche
Copy link
Member

Fixed with PR

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

No branches or pull requests

2 participants