[TYPO3-mvc] Re: FormViewHelper - Serialization of 'Closure' is not allowed

Viktor Livakivskyi invisible.kinder at gmail.com
Tue Sep 15 11:25:28 CEST 2015


Small update:

> 8. Submitting with 'activationSource'  *empty* - Fatal Error is thrown: "Argument 1 passed to MyController::firstVariantAction() must be an instance of Code, null given"
> 
> Reason: in case of validation error (e.g. empty field), errorAction() is triggered, which tries to fetch arguments from referring request and redirects to it. The problem is, that when serialize() is executed in FromViewHelper, for whatever reason it doesn't use result of __sleep() call from my model and stores encoded version of "a:1:{s:4:"code";N;}". So, on unserialization in referring request this information is lost.
> 
> Possible fix: allow NULL in action, to which action was forwarded: firstVariantAction(Code $code = NULL)

This was my bad, because I should have return not $this->activationCode in __sleep(), but array of properties to serialize (e.g.: array_keys($this->_getProperties())).

Interesting thing is, that __sleep() is called only, when I'm working with not yet persistent object. When I'm editing existing object, then no call to __sleep() is made, and serialized string contains not the whole list of properties, but only uid. Tried to debug to find out, which code does this magic, but wasn't able to find it.
Does anyone have a clue about it?


More information about the TYPO3-project-typo3v4mvc mailing list