Bug #87899
closed
Magic getters stop to be evaluated in Fluid starting from TYPO3 9
Added by Felix Althaus over 5 years ago.
Updated about 5 years ago.
Description
I found a breaking change in sysext/fluid
that was considered non-breaking
I‘m referring to this change:
https://review.typo3.org/c/Packages/TYPO3.CMS/+/54043
which relates to this task:
https://forge.typo3.org/issues/82229
My Problem:
We assign an object to a standalone view that uses __call
magic method to mimic getter calls.
Up to TYPO3 8.7 there was a class call \TYPO3\CMS\Fluid\Core\Variables\CmsVariableProvider
which used ObjectAccess::getPropertyPath
internally to fetch values. Magic getters worked well, since ObjectAccess uses is_callable
internally.
Starting from TYPO3 9.x this class was removed. It‘s now \TYPO3Fluid\Fluid\Core\Variables\StandardVariableProvider
that will do the job. In the end method_exists
is called which means the magic function is not called.
That leads to the conclusion that the original change was breaking.
- Related to Task #82229: Remove extended fluid core class added
- Status changed from New to Closed
I'm going to set this ticket to closed, as that should be implemented in Fluid itself.
For anyone having the same problem:
I our case we could move from magic methods _call()
to implementing ArrayAccess
in our class. This way you can still have an undefined set of properties since the existence of a (virtual) property is determined by a call to offsetExists()
then.
Felix Althaus wrote:
For anyone having the same problem:
I our case we could move from magic methods _call()
to implementing ArrayAccess
in our class. This way you can still have an undefined set of properties since the existence of a (virtual) property is determined by a call to offsetExists()
then.
Thanks for the hint. We've had the same problem!
- Related to Bug #90215: Getters of class LazyLoadingProxy can't be called by Fluid added
- Related to Bug #87651: Lazy loading (sometimes) not working in Fluid (only n:1 relations) added
Also available in: Atom
PDF