Bug #13559
ObjectSerializer failes with persistent objects within arrays
| Status: | Accepted | Start date: | 2011-03-02 | |
|---|---|---|---|---|
| Priority: | Should have | Due date: | ||
| Assignee: | Karsten Dambekalns | % Done: | 0% |
|
| Category: | Persistence | |||
| Target version: | - | |||
| PHP Version: | Complexity: | |||
| Has patch: | No | FLOW3 version affected: | FLOW3 1.0.0 | |
| Votes: | 0 |
Description
If a persistent object is contained in an array property, the serialization failes. It won't detect the object as persistent but will persist it as if it was a simple data object. This will be broken as soon as the session is resumed/ the object serializer is unserializing this data stream.
The reason is that persistent object detection is only present in method serializeObjectAsPropertyArray. Method buildStorageArrayForArrayProperty only contains a small is_object that won't respect the persistence:
if (is_object($value)) {
$storableArray[$key][self::TYPE] = 'object';
$storableArray[$key][self::VALUE] = spl_object_hash($value);
$this->serializeObjectAsPropertyArray($value, FALSE);
}
Related issues
| related to TYPO3.Flow - Bug #42715: ObjectSerializer not capable of Collections | Resolved | 2012-11-06 |
History
Updated by Karsten Dambekalns over 1 year ago
- FLOW3 version affected set to FLOW3 1.0.0
Updated by Christian Mueller about 1 year ago
- Status changed from New to Needs Feedback
- Has patch set to No
Persistable Objects should best be stored in a Doctrine Collection like the ArrayCollection. Then persistence will persist the objects properly. Do we still want to fix this somehow?
Updated by Karsten Dambekalns 7 months ago
- Category set to Persistence
- Status changed from Needs Feedback to Accepted
- Assignee set to Karsten Dambekalns
Possible without too much hassle.