Bug #66473

Cannot create object implementing Serializable on PHP 5.6

Added by Mathias Brodala over 4 years ago. Updated almost 2 years ago.

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

100%

TYPO3 Version:
7
PHP Version:
5.6
Tags:
Complexity:
Is Regression:
No
Sprint Focus:
Stabilization Sprint

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.


Related issues

Related to TYPO3 Core - Bug #66468: TYPO3 6.2 will live longer than PHP 5.5 but is not compatible with PHP 5.6 Rejected 2015-04-17
Related to TYPO3 Core - Task #66911: Travis: Verify no git submodule exists Closed 2015-05-12
Related to TYPO3 Core - Bug #67272: initializeObject() not called for Extbase Domain Model Closed 2015-06-03
Related to TYPO3 Core - Bug #67402: Document "__wakeup" no longer called in AbstractDomainObjects as breaking (?) Closed 2015-06-10
Related to TYPO3 Core - Bug #67408: Nail down php 5.6 instantiation issues in tests Closed 2015-06-11
Related to TYPO3 Core - Bug #66482: Extbase persistence layer fails to create empty objects in PHP 5.6. Closed 2015-04-19
Related to TYPO3 Core - Task #72112: travis-ci: PHP 5.6 not allowed_failure anymore Closed 2015-12-08

Associated revisions

Revision 89cbe117 (diff)
Added by Mathias Brodala over 4 years ago

[BUGFIX] Fix serializable object creation with PHP 5.6

This makes use of doctrine/instantiator to catch this and many
other PHP issues when instantiating objects without constructor.

Resolves: #66473
Releases: master, 6.2
Change-Id: Iaba0de638b8b555a811dad22a140d0348c168eb5
Reviewed-on: http://review.typo3.org/38765
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>
Reviewed-by: Helmut Hummel <>
Reviewed-by: Frank Nägler <>
Tested-by: Frank Nägler <>

Revision 169a6b2f (diff)
Added by Mathias Brodala over 4 years ago

[BUGFIX] Fix serializable object creation with PHP 5.6

This makes use of doctrine/instantiator to catch this and many
other PHP issues when instantiating objects without constructor.

Resolves: #66473
Releases: master, 6.2
Change-Id: Iaba0de638b8b555a811dad22a140d0348c168eb5
Reviewed-on: http://review.typo3.org/39377
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>

Revision 3e8f5c46 (diff)
Added by Helmut Hummel over 4 years ago

[BUGFIX] Fix serializable object creation with PHP 5.6

This makes use of doctrine/instantiator to catch this and many
other PHP issues when instantiating objects without constructor.

Resolves: #66473
Resolves: #66885
Releases: master, 6.2
Change-Id: Ic60b4fda6f4d7aa3f61ce46263011a89f6301f3d
Reviewed-on: http://review.typo3.org/39392
Reviewed-by: Markus Klein <>
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>
Reviewed-by: Helmut Hummel <>
Tested-by: Helmut Hummel <>

Revision 59d75c05 (diff)
Added by Christian Kuhn over 4 years ago

[TASK] Travis: Verify no git submodule exists

With backport of issue #66473 a git submodule definition was
accidently commited. The patch adds an additional travis-ci
check to make the suite fail in case this happens again.

Resolves: #66911
Releases: master, 6.2
Change-Id: I88d22ceea3c82a805db4e9e61cb1fdd8aec76383
Reviewed-on: http://review.typo3.org/39480
Reviewed-by: Wouter Wolters <>
Tested-by: Wouter Wolters <>
Reviewed-by: Helmut Hummel <>
Tested-by: Helmut Hummel <>

Revision 0d72276e (diff)
Added by Christian Kuhn over 4 years ago

[TASK] Travis: Verify no git submodule exists

With backport of issue #66473 a git submodule definition was
accidently commited. The patch adds an additional travis-ci
check to make the suite fail in case this happens again.

Resolves: #66911
Releases: master, 6.2
Change-Id: I88d22ceea3c82a805db4e9e61cb1fdd8aec76383
Reviewed-on: http://review.typo3.org/39497
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>

Revision ec4f49f6 (diff)
Added by Morton Jonuschat over 4 years ago

[BUGFIX] Call initializeObject() after instantiating empty objects

If the object is initializable and has a callable initializeObject()
method run that so that initialization work will be done.

This affects model instances retrieved from the persistence.

Resolves: #67272
Resolves: #67274
Related: #66473
Releases: master, 6.2
Change-Id: I7b0278855270e8fa6ef75a424d339d072af29c54
Reviewed-on: http://review.typo3.org/39914
Reviewed-by: Mathias Brodala <>
Tested-by: Mathias Brodala <>
Reviewed-by: Stefan Neufeind <>
Reviewed-by: Andreas Fernandez <>
Reviewed-by: Frans Saris <>
Tested-by: Frans Saris <>
Reviewed-by: Andreas Wolf <>
Tested-by: Andreas Wolf <>

Revision af1b31ba (diff)
Added by Christian Kuhn over 4 years ago

[TASK] Nail down php 5.6 instantiation issues in tests

We know PHP 5.6 has issues in 6.2 in extbase object creation.
The patch adds the unit test from the "instantiator" patch
of issue #66473. This test fails, so travis-ci is configured
with PHP 5.6 as known failure at the moment.

With the instantiator patch applied, initializeObject() was
no longer called in some PHP versions, another test is added
to verify this regression can not show up again.

The test bed currently ensures:
  • PHP 5.6 fails with current version
  • PHP 5.4, 5.5 and 5.6 would fail if only "instantiator" patch
    from #66473 is applied
  • PHP 5.3 fails with "initializeObject is called twice" if patch
    from #67274 is applied

Later is to get 5.6 green again with no further failure in other
PHP versions with other patches in 6.2 without changing tests.

Resolves: #67408
Related: #66473
Related: #67274
Releases: 6.2
Change-Id: Id4e81877e696dd1abc5b39497a19fa20a702048c
Reviewed-on: http://review.typo3.org/40163
Reviewed-by: Helmut Hummel <>
Tested-by: Helmut Hummel <>

Revision 8d41fb26 (diff)
Added by Morton Jonuschat over 4 years ago

[TASK] Document DI happening before initializeObject()

Changes in the execution of dependency injection and object
initialization have been documented as an important change.

Resolves: #67401
Related: #67274
Related: #67272
Related: #66473
Releases: master
Change-Id: Iab0cb89d7ed77ceaeafb1f87b19b750f73f45eda
Reviewed-on: http://review.typo3.org/40195
Reviewed-by: Mathias Brodala <>
Tested-by: Mathias Brodala <>
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>
Reviewed-by: Andreas Fernandez <>
Tested-by: Andreas Fernandez <>

Revision 1487e775 (diff)
Added by Morton Jonuschat over 4 years ago

[FOLLOWUP][TASK] Document DI happening before initializeObject()

Clarify that the changes to dependency injection only affect domain
models retrieved from the database backend.

Resolves: #67401
Related: #67274
Related: #67272
Related: #66473
Releases: master
Change-Id: I04876b77c3ae5d061bae4b6b238d820a7f875740
Reviewed-on: http://review.typo3.org/40213
Reviewed-by: Nicole Cordes <>
Tested-by: Nicole Cordes <>
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>

Revision cc462e9d (diff)
Added by Christian Kuhn over 4 years ago

[TASK] Deprecate AbstractDomainObject::__wakeup and document changes

Resolves: #67402
Related: #66473
Releases: master
Change-Id: I4a493bd778b2fefdc39fbd7783f406d3fbbebabb
Reviewed-on: http://review.typo3.org/40245
Reviewed-by: Frank Nägler <>
Tested-by: Frank Nägler <>
Reviewed-by: Helmut Hummel <>
Tested-by: Helmut Hummel <>

Revision 9faa965d (diff)
Added by Helmut Hummel almost 4 years ago

[BUGFIX] Fix serializable object creation with PHP 5.6

This makes use of doctrine/instantiator to catch this and many
other PHP issues when instantiating objects without constructor.

Resolves: #66473
Resolves: #66885
Releases: 6.2
Change-Id: Ibeaf94ca8227befc4f5a863dd4b688c54b8fcd4c
Reviewed-on: https://review.typo3.org/40522
Reviewed-by: Stephan Großberndt <>
Tested-by: Stephan Großberndt <>
Reviewed-by: Alexander Opitz <>
Tested-by: Alexander Opitz <>
Reviewed-by: Oliver Hader <>
Tested-by: Oliver Hader <>

Revision f107bcde (diff)
Added by Christian Kuhn almost 4 years ago

[TASK] travis-ci: PHP 5.6 not allowed_failure anymore

Change-Id: Ide32a6a582ec7dd1671b97b9d11c9b88a56953fd
Resolves: #72112
Related: #66473
Releases: 6.2
Reviewed-on: https://review.typo3.org/45186
Reviewed-by: Wouter Wolters <>
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>

History

#1 Updated by Gerrit Code Review over 4 years ago

  • Status changed from New to Under Review

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/38765

#2 Updated by Mathias Brodala over 4 years ago

See also this change in phpunit for a few caveats.

#3 Updated by Mathias Brodala over 4 years ago

Maybe we should use doctrine/instantiator since apparently there are even more issues with this.

#4 Updated by Helmut Hummel over 4 years ago

Mathias Brodala wrote:

Maybe we should use "doctrine/instantiator"

Yes, please!

#5 Updated by Gerrit Code Review over 4 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/38765

#6 Updated by Gerrit Code Review over 4 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/38765

#7 Updated by Gerrit Code Review over 4 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/38765

#8 Updated by Gerrit Code Review over 4 years ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/38765

#9 Updated by Mathias Brodala over 4 years ago

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

#10 Updated by Christian Kuhn over 4 years ago

  • Status changed from Resolved to Accepted
  • Target version changed from next-patchlevel to 6.2.13

master merged, now waiting for 6.2 backport.

#11 Updated by Gerrit Code Review over 4 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/39377

#12 Updated by Gerrit Code Review over 4 years ago

Patch set 2 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/39377

#13 Updated by Gerrit Code Review over 4 years ago

Patch set 3 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/39377

#14 Updated by Gerrit Code Review over 4 years ago

Patch set 4 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/39377

#15 Updated by Mathias Brodala over 4 years ago

  • Status changed from Under Review to Resolved

#16 Updated by Michael Stucki over 4 years ago

  • Status changed from Resolved to Accepted
  • % Done changed from 100 to 50

This change contains an error for TYPO3_6-2, see https://review.typo3.org/#/c/39390/

After discussion with Lolli, I have reverted the change until this is fixed properly...

#17 Updated by Gerrit Code Review over 4 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/39392

#18 Updated by Gerrit Code Review over 4 years ago

Patch set 2 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/39392

#19 Updated by Gerrit Code Review over 4 years ago

Patch set 3 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/39392

#20 Updated by Gerrit Code Review over 4 years ago

Patch set 4 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/39392

#21 Updated by Gerrit Code Review over 4 years ago

Patch set 5 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/39392

#22 Updated by Gerrit Code Review over 4 years ago

Patch set 6 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/39392

#23 Updated by Gerrit Code Review over 4 years ago

Patch set 7 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/39392

#24 Updated by Gerrit Code Review over 4 years ago

Patch set 8 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/39392

#25 Updated by Helmut Hummel over 4 years ago

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

#26 Updated by Alexander Opitz over 4 years ago

  • Status changed from Resolved to In Progress
  • Target version changed from 6.2.13 to 6.2.14

Was reverted in https://review.typo3.org/#/c/40133/ so reopen.

#27 Updated by Alexander Opitz about 4 years ago

  • Target version changed from 6.2.14 to 6.2.15

#28 Updated by Christian Kuhn about 4 years ago

  • Sprint Focus set to Stabilization Sprint

#29 Updated by Mathias Bruckmoser about 4 years ago

6.2.15 Released today.
Is it fixed or not?

#30 Updated by Alexander Opitz about 4 years ago

  • Target version changed from 6.2.15 to 6.2.16

No it wasn't fixed.

#31 Updated by Gerrit Code Review almost 4 years ago

  • Status changed from In Progress to Under Review

Patch set 8 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/40522

#32 Updated by Gerrit Code Review almost 4 years ago

Patch set 9 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/40522

#33 Updated by Gerrit Code Review almost 4 years ago

Patch set 10 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/40522

#34 Updated by Helmut Hummel almost 4 years ago

  • Status changed from Under Review to Resolved

#35 Updated by Riccardo De Contardi almost 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF