DDC-184: Infinite recursion on toArray() with manyToMany bidirectional relationships #227

Closed
opened 2026-01-22 12:31:30 +01:00 by admin · 8 comments
Owner

Originally created by @doctrinebot on GitHub (Nov 30, 2009).

Originally assigned to: @guilhermeblanco on GitHub.

Jira issue originally created by user russ:

When specifying a bidirectional @manyToMany relationship, the Doctrine ActiveRecord locks up on toArray(). Line 154 ($array[$name] = $this->toArray($value);) is run thousands of times, presumably because the relations are constantly loading each other.

Everything works fine when I comment out that line, but that will surely break something else somewhere!

Hydrating these objects as arrays also works fine.

Originally created by @doctrinebot on GitHub (Nov 30, 2009). Originally assigned to: @guilhermeblanco on GitHub. Jira issue originally created by user russ: When specifying a bidirectional @manyToMany relationship, the Doctrine ActiveRecord locks up on toArray(). Line 154 ($array[$name] = $this->toArray($value);) is run thousands of times, presumably because the relations are constantly loading each other. Everything works fine when I comment out that line, but that will surely break something else somewhere! Hydrating these objects as arrays also works fine.
admin added the Bug label 2026-01-22 12:31:30 +01:00
admin closed this issue 2026-01-22 12:31:32 +01:00
Author
Owner

@doctrinebot commented on GitHub (Nov 30, 2009):

Comment created by romanb:

Is this probably related to the sfDoctrine2Plugin ? Since there is no ActiveRecord / toArray in Doctrine 2 itself.

@doctrinebot commented on GitHub (Nov 30, 2009): Comment created by romanb: Is this probably related to the sfDoctrine2Plugin ? Since there is no ActiveRecord / toArray in Doctrine 2 itself.
Author
Owner

@doctrinebot commented on GitHub (Nov 30, 2009):

Comment created by russ:

Attached patch: Stab in the dark but this makes sense and seems to solve the problem for me

@doctrinebot commented on GitHub (Nov 30, 2009): Comment created by russ: Attached patch: Stab in the dark but this makes sense and seems to solve the problem for me
Author
Owner

@doctrinebot commented on GitHub (Nov 30, 2009):

Comment created by russ:

@Roman, yes - is Active_Record maintained separately somewhere?

I'm not entirely sure if it's a problem with Active_Record or a problem with the Doctrine metadata, but adding the dirty state at least seems to fix the problem for me.

@doctrinebot commented on GitHub (Nov 30, 2009): Comment created by russ: @Roman, yes - is Active_Record maintained separately somewhere? I'm not entirely sure if it's a problem with Active_Record or a problem with the Doctrine metadata, but adding the dirty state at least seems to fix the problem for me.
Author
Owner

@doctrinebot commented on GitHub (Nov 30, 2009):

Comment created by romanb:

Yes, I think it is maintained in the symfony trac and svn. I will assign this to Jon here anyway.

@doctrinebot commented on GitHub (Nov 30, 2009): Comment created by romanb: Yes, I think it is maintained in the symfony trac and svn. I will assign this to Jon here anyway.
Author
Owner

@doctrinebot commented on GitHub (Dec 7, 2009):

Comment created by @jwage:

It is a Doctrine extension. Maybe we can use Jira projects for extensions? It is a tough decision because eventually we may have a lot of extensions and it would clutter Jira. I think maybe we might use github to host all Doctrine extensions and mirror them to our SVN or something.

@doctrinebot commented on GitHub (Dec 7, 2009): Comment created by @jwage: It is a Doctrine extension. Maybe we can use Jira projects for extensions? It is a tough decision because eventually we may have a lot of extensions and it would clutter Jira. I think maybe we might use github to host all Doctrine extensions and mirror them to our SVN or something.
Author
Owner

@doctrinebot commented on GitHub (Dec 9, 2009):

Comment created by @guilhermeblanco:

In r6903 this issue was fixed! Thanks for the patch!

@doctrinebot commented on GitHub (Dec 9, 2009): Comment created by @guilhermeblanco: In r6903 this issue was fixed! Thanks for the patch!
Author
Owner

@doctrinebot commented on GitHub (Dec 9, 2009):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Dec 9, 2009): Issue was closed with resolution "Fixed"
Author
Owner

@doctrinebot commented on GitHub (Dec 13, 2015):

Imported 1 attachments from Jira into https://gist.github.com/661786b3f62271677178

@doctrinebot commented on GitHub (Dec 13, 2015): Imported 1 attachments from Jira into https://gist.github.com/661786b3f62271677178 - [10192_Active_Entity-DDC-184.patch](https://gist.github.com/661786b3f62271677178#file-10192_Active_Entity-DDC-184-patch)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#227