Bug #36820

FLUIDTEMPLATE - Serialization of 'Closure' is not allowed

Added by Oliver Hader over 7 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
Content Rendering
Target version:
Start date:
2012-05-03
Due date:
% Done:

100%

TYPO3 Version:
4.6
PHP Version:
5.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

A tricky one that was reported for the YAG extension as well.

What you need:

  • FLUIDTEMPLATE
  • COA_INT or USER_INT

Example:

page.20 = FLUIDTEMPLATE
page.20 {
  file = fileadmin/fluid.html
  partialRootPath = fileadmin/Partials/
}

page.30 = COA_INT
page.30.10 = TEXT
page.30.10.value = TEST

Contents of the Fluid Template file (fileadmin/fluid.html):

<f:render partial="Test" />

Contents of the Test partial (fileadmin/Partials/Test.html):

HELLO WORLD

Now, call the page (to have it cached) and then call another page that uses that cache - you should see a nice error/exception for handling the COA_INT.

Explanation:
  • The Partial handling in the RenderViewHelper will store a compiled version, using Closure in the cache
  • Thus, the first call works, but the second one, using the cache will use the Closure
  • The serialize($this->cObj) in COA_INT will stumble over the Closure deep down in cObj and fail

Closures have been introduced in Fluid with TYPO3 4.6.

Associated revisions

Revision 7e63fe16 (diff)
Added by Oliver Hader over 7 years ago

[BUGFIX] FLUIDTEMPLATE - Serialization of 'Closure' is not allowed

The Fluid TemplateCompiler uses closures to store a cached
variant of the accordant Fluid node. Several calls in Fluid
use serialize() and also will process those closures, which
will end up in a PHP fatal error.

The most obvious part is the object manager which will then
try to serialize all objects - including closures - that are
available in the object container.

The problem can be circumvented by using accordant magic PHP
methods like __sleep() and __wakeup() to ignore those properties.

Change-Id: I70e78a09b2a118cc26f099063743c530f0addc72
Fixes: #32295
Related: #36820
Releases: 6.0, 4.7, 4.6

Revision 0ffad327 (diff)
Added by Oliver Hader over 7 years ago

[BUGFIX] FLUIDTEMPLATE - Serialization of 'Closure' is not allowed

The Fluid TemplateCompiler uses closures to store a cached
variant of the accordant Fluid node. Several calls in Fluid
use serialize() and also will process those closures, which
will end up in a PHP fatal error.

The most obvious part is the object manager which will then
try to serialize all objects - including closures - that are
available in the object container.

The problem can be circumvented by using accordant magic PHP
methods like __sleep() and __wakeup() to ignore those properties.

Change-Id: I00b769860465632e397c9c707f0da5d3d52ae1dd
Fixes: #32295
Related: #36820
Releases: 6.0, 4.7, 4.6

Revision da63d294 (diff)
Added by Oliver Hader over 7 years ago

[BUGFIX] FLUIDTEMPLATE - Serialization of 'Closure' is not allowed

The Fluid TemplateCompiler uses closures to store a cached
variant of the accordant Fluid node. Several calls in Fluid
use serialize() and also will process those closures, which
will end up in a PHP fatal error.

The most obvious part is the object manager which will then
try to serialize all objects - including closures - that are
available in the object container.

The problem can be circumvented by using accordant magic PHP
methods like __sleep() and __wakeup() to ignore those properties.

Change-Id: I785d472b6a9348dc873d657c1d0d07eb2b83bfda
Fixes: #32295
Related: #36820
Releases: 6.0, 4.7, 4.6

Revision 15d99ae6 (diff)
Added by Oliver Hader over 7 years ago

[BUGFIX] FLUIDTEMPLATE - Serialization of 'Closure' is not allowed

When using FLUIDTEMPLATE and COA_INT or USER_INT on the same
level and partials are used in the Fluid template, then there
will be Closures. COA_INT and USER_INT are going to serialize
the cObj, which fails when a Closure shall be processed.

Since the Closures have been collected in $cObj->contentObjects
the fix is to use a cloned version of the cObj which does not
contain these contentObjects anymore for COA_INT and USER_INT.

Change-Id: I5c1f9b01caef1df5077955bd7fa6e879e41ca854
Fixes: #36820
Related: #32295
Releases: 6.0, 4.7, 4.6
Reviewed-on: http://review.typo3.org/10979
Reviewed-by: Susanne Moog
Tested-by: Susanne Moog
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
Reviewed-by: Benjamin Mack
Tested-by: Benjamin Mack

Revision 6ac16ed8 (diff)
Added by Oliver Hader about 7 years ago

[BUGFIX] FLUIDTEMPLATE - Serialization of 'Closure' is not allowed

When using FLUIDTEMPLATE and COA_INT or USER_INT on the same
level and partials are used in the Fluid template, then there
will be Closures. COA_INT and USER_INT are going to serialize
the cObj, which fails when a Closure shall be processed.

Since the Closures have been collected in $cObj->contentObjects
the fix is to use a cloned version of the cObj which does not
contain these contentObjects anymore for COA_INT and USER_INT.

Change-Id: I5c1f9b01caef1df5077955bd7fa6e879e41ca854
Fixes: #36820
Related: #32295
Releases: 6.0, 4.7, 4.6
Reviewed-on: http://review.typo3.org/10979
Reviewed-by: Susanne Moog
Tested-by: Susanne Moog
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
Reviewed-by: Benjamin Mack
Tested-by: Benjamin Mack

Revision a45fe335 (diff)
Added by Oliver Hader about 7 years ago

[BUGFIX] FLUIDTEMPLATE - Serialization of 'Closure' is not allowed

When using FLUIDTEMPLATE and COA_INT or USER_INT on the same
level and partials are used in the Fluid template, then there
will be Closures. COA_INT and USER_INT are going to serialize
the cObj, which fails when a Closure shall be processed.

Since the Closures have been collected in $cObj->contentObjects
the fix is to use a cloned version of the cObj which does not
contain these contentObjects anymore for COA_INT and USER_INT.

Change-Id: Ib3d69da33940c05708b29efa42cddf521af9014b
Fixes: #36820
Related: #32295
Releases: 6.0, 4.7, 4.6
Reviewed-on: http://review.typo3.org/13896
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter

Revision 51c3f8fb (diff)
Added by Oliver Hader about 7 years ago

[BUGFIX] FLUIDTEMPLATE - Serialization of 'Closure' is not allowed

When using FLUIDTEMPLATE and COA_INT or USER_INT on the same
level and partials are used in the Fluid template, then there
will be Closures. COA_INT and USER_INT are going to serialize
the cObj, which fails when a Closure shall be processed.

Since the Closures have been collected in $cObj->contentObjects
the fix is to use a cloned version of the cObj which does not
contain these contentObjects anymore for COA_INT and USER_INT.

Change-Id: I03dada20a133474f5260d432cbf75fd29c2b11e7
Fixes: #36820
Related: #32295
Releases: 6.0, 4.7, 4.6
Reviewed-on: http://review.typo3.org/13897
Reviewed-by: Stefan Neufeind
Reviewed-by: Xavier Perseguers
Tested-by: Xavier Perseguers

History

#1 Updated by Oliver Hader over 7 years ago

  • Target version changed from 4.5.16 to 4.6.9
  • TYPO3 Version changed from 4.5 to 4.6

#2 Updated by Oliver Hader over 7 years ago

  • Status changed from New to Accepted

#3 Updated by Gerrit Code Review over 7 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/10979

#4 Updated by Gerrit Code Review over 7 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/10979

#5 Updated by Gerrit Code Review over 7 years ago

Patch set 3 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/10979

#6 Updated by Oliver Hader over 7 years ago

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

#7 Updated by Riccardo De Contardi almost 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF