Bug #11893

The hash identifying a ValueObject isn't sufficient

Added by Jochen Rau over 4 years ago. Updated about 4 years ago.

Status:Resolved Start date:2011-01-05
Priority:Should have Due date:
Assigned To:Karsten Dambekalns % Done:

100%

Category:Persistence
Target version:TYPO3 Flow Base Distribution - 1.0 beta 1
PHP Version: Complexity:
Has patch: Affected Flow version:

Description

After executing the constructor of a Value Object a hash is generated and stored in FLOW3_Persistence_ValueObject_Hash to identify the Value Object (eg. to support getIdentifierByObject($object)). But the algorithm for generating the hash isn't sufficient for some cases.

Let's assume we have a Value Object \F3\MyExt\Domain\Model\Color with a property $colorNumber=42. This Value Object has the same hash as a Value Object \F3\MyExt\Domain\Model\Length with a property $value=42. The same problem occurs, if a Value Object stores other objects in an SplObjectStorage or uses PHP classes like DateTime.

IMHO the identity of a ValueObject is fully determined only by taking all property values (including SplObjectStorages) and the class into account. The test for FLOW3_Persistence_Entity_UUID could possibly be dropped as a Value Object by definition can't reference to Entities.

Associated revisions

Revision c3f667d0
Added by Karsten Dambekalns about 4 years ago

[BUGFIX] Make value object hash calculation more robust

Change-Id: I45a4602fc6075aa8a19d7eebafda21b054aafabf
Fixes: #11893

History

#1 Updated by Karsten Dambekalns about 4 years ago

  • Status changed from New to Accepted
  • Assigned To set to Karsten Dambekalns
  • Target version set to 1.0 beta 1

#2 Updated by Mr. Hudson about 4 years ago

Patch set 1 of change I45a4602fc6075aa8a19d7eebafda21b054aafabf has been pushed to the review server.
It is available at http://review.typo3.org/2356

#3 Updated by Mr. Hudson about 4 years ago

Patch set 2 of change I45a4602fc6075aa8a19d7eebafda21b054aafabf has been pushed to the review server.
It is available at http://review.typo3.org/2356

#4 Updated by Karsten Dambekalns about 4 years ago

  • Status changed from Accepted to Under Review

#5 Updated by Mr. Hudson about 4 years ago

Patch set 3 of change I45a4602fc6075aa8a19d7eebafda21b054aafabf has been pushed to the review server.
It is available at http://review.typo3.org/2356

#6 Updated by Mr. Hudson about 4 years ago

Patch set 4 of change I45a4602fc6075aa8a19d7eebafda21b054aafabf has been pushed to the review server.
It is available at http://review.typo3.org/2356

#7 Updated by Karsten Dambekalns about 4 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF