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

spl_object_hash() vs spl_object_id() #9141

Closed
franmomu opened this issue Oct 21, 2021 · 3 comments · Fixed by #9143
Closed

spl_object_hash() vs spl_object_id() #9141

franmomu opened this issue Oct 21, 2021 · 3 comments · Fixed by #9143
Labels

Comments

@franmomu
Copy link
Contributor

franmomu commented Oct 21, 2021

BC Break Report

Q A
BC Break yes
Version 2.10

Summary

After #8837, there are some UoW methods that the parameter has changed:

/**
* INTERNAL:
* Clears the property changeset of the entity with the given OID.
*
* @param int $oid The entity's OID.
*
* @return void
*/
public function clearEntityChangeSet($oid)
{
unset($this->entityChangeSets[$oid]);
}

/**
* INTERNAL:
* Sets a property value of the original data array of an entity.
*
* @param int $oid
* @param string $property
* @param mixed $value
*
* @return void
*
* @ignore
*/
public function setOriginalEntityProperty($oid, $property, $value)
{
$this->originalEntityData[$oid][$property] = $value;
}

Because the OID is different, at first I thought they were internal, but apparently it is some kind of internal notes.

Previous behavior

Before this, for calling these method you should generate the oid with spl_object_hash()

Current behavior

Now that oid is not valid anymore.

How to reproduce

Tests started to fail in https://github.com/doctrine-extensions/DoctrineExtensions

@greg0ire
Copy link
Member

Hi! Can you please link to the failing tests?

@franmomu
Copy link
Contributor Author

franmomu commented Oct 21, 2021

Sure!

UPDATE 2: with an ugly fix to call spl_object_hash() for ODM and spl_object_id() for ORM tests pass: franmomu/DoctrineExtensions#9

@greg0ire
Copy link
Member

Great job! Since you are not stuck, I think it's fine not to revert this, and to document the minor BC-break.

greg0ire added a commit to greg0ire/doctrine-orm that referenced this issue Oct 21, 2021
derrabus pushed a commit that referenced this issue Oct 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants