Issue Bug Closed

#66473Cannot create object implementing Serializable on PHP 5.6

Mathias Brodala 04/17/15, 18:05 updated 10/23/17, 21:48

Description

Starting with PHP 5.6 classes implementing the Serializable interface are represented as C instead of O in the serialized output.

The Container::getEmptyObject method which creates objects with the unserialize hack to avoid calling the constructor thus yields an error like this:

> Warning: Erroneous data format for unserializing ‘Foo’ in …
> Notice: unserialize(): Error at offset 13 of 15 bytes in …

Starting with PHP 5.4 this usecase can be dealt with by @ReflectionClass::newInstanceWithoutConstructor@

This also needs to fixed for TYPO3 6.2 though which supports PHP 5.3, in which case checking for the Serializable interface and using C instead of O could work.

Reviews 11