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

DDC-3827: [GH-1461] Spl_object_hash conflict on Merge #4675

Closed
doctrinebot opened this issue Jul 15, 2015 · 1 comment
Closed

DDC-3827: [GH-1461] Spl_object_hash conflict on Merge #4675

doctrinebot opened this issue Jul 15, 2015 · 1 comment
Assignees

Comments

@doctrinebot
Copy link

Jira issue originally created by user @doctrinebot:

This issue is created automatically through a Github pull request on behalf of moroine:

Url: #1461

Message:

Hi,

First of all, this is just a proposal and I'm sure there is a better solution for the problem described here. As this is my first hack into doctrine source code I'm not sure consequences that might be cause by my modification (even all unit tests passes).

I have encounter a problem due to spl_object_hash. I have written a functional test in order to reveal my issue.

The problem is when I merge an entity, here $user, UOW keep data on the original entity identified by it's spl_object_hash. Then if I unset this $user the spl_object_hash is now available for new object. So I experimented in my case reuse of previous hash which cause a managed+dirty entity error.

So I see two solutions

  • UOW keep reference to the entity given as even the given variable is unset there is remaining reference in UOW so the spl_hash will not be released.
  • Do not store data about the given entity, as merge operation isn't supposed to modified given entity.

I tried to implement the second solution as the first may consume a much more memory.

I don't why the merge operation need to do this, so I encapsulated it to prevent unwanted bug :)

@Majkl578
Copy link
Contributor

Duplicate of #3037, also merge will be removed in Doctrine 3.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants