Bug #66482

Extbase persistence layer fails to create empty objects in PHP 5.6.

Added by Klaus Bitto over 6 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Extbase
Target version:
Start date:
2015-04-19
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
5.6
Tags:
Complexity:
easy
Is Regression:
No
Sprint Focus:
Stabilization Sprint

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


Related issues

Related to TYPO3 Core - Bug #66473: Cannot create object implementing Serializable on PHP 5.6ClosedMathias Brodala2015-04-17

Actions
Related to TYPO3 Core - Bug #70873: Fix inconsistency of the calling order of Container::injectDependencies() and AbstractEntity::initializeObject()Rejected2015-10-20

Actions
Related to TYPO3 Core - Feature #70874: ClassInfo::getIsInitializeable() is not reliableClosed2015-10-20

Actions

Also available in: Atom PDF