Bug #66482
closedExtbase persistence layer fails to create empty objects in PHP 5.6.
0%
Description
The extbase persistence layer (actually the object container) creates empty objects, by-passing the constructor, by unserializing a faked serialized empty object.
This no longer works in PHP 5.6. The unserialize()
call fails fatally ("Erroneous data format").
http://php.net/manual/en/function.unserialize.php:
Changelog --------- Version Description 5.6.0 *Manipulating the serialised data by replacing C: with O: to force object instantiation without calling the constructor will now fail.*
Instead of unserialize()
, public object ReflectionClass::newInstanceWithoutConstructor ( void )
must be used: http://php.net/manual/de/reflectionclass.newinstancewithoutconstructor.php (PHP >= 5.4)
TYPO3 6.2 was declared to be compatible with PHP <= 5.5, until 2 days ago, when I reported https://forge.typo3.org/issues/66468.
Now, TYPO3 6.2 is officially declared as compatible to PHP 5.3.7-5.6.x (http://typo3.org/download/). Therefore I regard this a high priority issue, as extbase is factually broken on PHP 5.6.
The error occurs in this line: https://github.com/TYPO3/TYPO3.CMS/blob/TYPO3_6-2/typo3/sysext/extbase/Classes/Object/Container/Container.php#L121
PHP 5.3 will still need the unserialize() call. PHP 5.4-5.6 can use ReflectionClass::newInstanceWithoutConstructor()
.
See also how Doctrine2 fixed the same issue: https://github.com/marmotz/doctrine2/commit/93c276d059b40b0783ba9a24549a8b135e257693