1
0
Fork 0
mirror of synced 2025-04-01 20:36:14 +03:00
doctrine2/lib/Doctrine/ORM
Mathieu De Zutter 01d51bfca3 Avoid conflicts due to spl_object_hash().
When merging an entity with a to-many association, it will store the
original entity data using the object hash of the to-be-merged entity
instead of the managed entity. Since this to-be-merged entity is not
managed by Doctrine, it can disappear from the memory. A new object
can reuse the same memory location and thus have the same object hash.
When one tries to persist this object as new, Doctrine will refuse it
because it thinks that the entity is managed+dirty.

This patch is a very naive fix: it just disables storing the original
entity data in case of to-many associations. It may not be the ideal
or even a good solution at all, but it solves the problem of object
hash reuse.

The test case relies on the immediate reusing of memory locations by
PHP. The variable $user has twice the same object hash, though referring
a different object. Tested on PHP 5.6.17

Without the fix, the test fails on the last line with:
A managed+dirty entity Doctrine\Tests\Models\CMS\CmsUser@[...] can not
be scheduled for insertion.
2016-09-09 23:22:31 +02:00
..
Cache The timestamp verification is now done by the validator 2016-09-08 13:50:06 +02:00
Decorator make lock mode usage consistent 2014-02-05 15:13:53 +01:00
Event Fixed many small phpcs issues 2015-12-11 20:30:41 +01:00
Id Fixed many small phpcs issues 2015-12-11 20:30:41 +01:00
Internal Use yoda condition in the null check 2016-09-08 13:37:00 +02:00
Mapping remove else 2016-07-03 00:21:00 +03:00
Persisters Expose EntityPersister::count() through EntityRepository::count() 2016-09-08 00:32:15 +02:00
Proxy Reduce code duplication in ProxyFactory::createInitialized 2015-12-06 14:56:36 +01:00
Query clear code 2016-07-01 01:20:52 +03:00
Repository #1159 - protecting Doctrine\ORM\Repository\DefaultRepositoryFactory API by making it final and its protected members private 2014-10-14 01:46:50 +02:00
Tools Exporters should only inspect joinColumns for owning side in bi-directional OneToOne 2016-06-08 13:24:43 +02:00
Utility Merge pull request #1474 from localheinz/fix/unused-imports 2015-09-04 08:30:46 +01:00
AbstractQuery.php Add timestamp key to QueryCacheKey 2016-09-08 13:50:06 +02:00
Cache.php DDC-3078 - constructor should never be interfaced 2014-04-17 15:16:56 -04:00
Configuration.php Fixed many small phpcs issues 2015-12-11 20:30:41 +01:00
EntityManager.php Update EntityManager.php 2016-07-05 12:48:00 -05:00
EntityManagerInterface.php #1172 - adding @method annotation to simplify static introspection 2015-01-16 22:50:52 +01:00
EntityNotFoundException.php #1240 DDC-3479 - Basic coverage for EntityNotFoundException 2015-01-13 02:55:51 +01:00
EntityRepository.php #6003 clarifying thrown exception 2016-09-08 00:55:49 +02:00
Events.php #385 #1181 DDC-3385 - fixing Events docblocks as per @deeky666's review 2015-01-13 21:15:34 +01:00
LazyCriteriaCollection.php Fixed many small phpcs issues 2015-12-11 20:30:41 +01:00
NativeQuery.php Fixed unused 'use' statements. 2012-12-13 18:19:21 +00:00
NonUniqueResultException.php Fixed unused 'use' statements. 2012-12-13 18:19:21 +00:00
NoResultException.php Fixed missed documentation issues in Doctrine\ORM 2012-12-14 20:12:56 +00:00
OptimisticLockException.php Fixed many small phpcs issues 2015-12-11 20:30:41 +01:00
ORMException.php Swap logic from EntityRespository::__call() 2016-09-08 00:32:15 +02:00
ORMInvalidArgumentException.php Fixed many small phpcs issues 2015-12-11 20:30:41 +01:00
PersistentCollection.php Remove unnecessary namespaces imports and usage 2015-12-16 05:45:55 -03:00
PessimisticLockException.php Fix some LGPL occurances to MIT 2013-10-02 12:07:37 +02:00
Query.php Fixed many small phpcs issues 2015-12-11 20:30:41 +01:00
QueryBuilder.php Fix typo in PHPDoc block of QueryBuilder.php 2016-06-20 14:20:36 +02:00
TransactionRequiredException.php Fix some LGPL occurances to MIT 2013-10-02 12:07:37 +02:00
UnexpectedResultException.php Fixed unused 'use' statements. 2012-12-13 18:19:21 +00:00
UnitOfWork.php Avoid conflicts due to spl_object_hash(). 2016-09-09 23:22:31 +02:00
Version.php Bumping version to 2.6.0-DEV 2015-04-02 21:42:47 +01:00