Bug #87899
closedMagic getters stop to be evaluated in Fluid starting from TYPO3 9
0%
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.
Updated by Claus Due over 5 years ago
Pull request for https://github.com/TYPO3/Fluid to use `is_callable` in https://github.com/TYPO3/Fluid/blob/master/src/Core/Variables/StandardVariableProvider.php would be appreciated. We will restore that behavior in Fluid itself to avoid re-introducing a variable provider for TYPO3 CMS.
Updated by Anja Leichsenring over 5 years ago
- Related to Task #82229: Remove extended fluid core class added
Updated by Felix Althaus over 5 years ago
I created a PR on github: https://github.com/TYPO3/Fluid/pull/438
Updated by Susanne Moog over 5 years ago
- Status changed from New to Closed
I'm going to set this ticket to closed, as that should be implemented in Fluid itself.
Updated by Felix Althaus over 5 years ago
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.
Updated by Ralph Brugger about 5 years ago
Felix Althaus wrote:
For anyone having the same problem:
I our case we could move from magic methods_call()
to implementingArrayAccess
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 tooffsetExists()
then.
Thanks for the hint. We've had the same problem!
Updated by Stephan Großberndt about 4 years ago
- Related to Bug #90215: Getters of class LazyLoadingProxy can't be called by Fluid added
Updated by Stephan Großberndt about 4 years ago
- Related to Bug #87651: Lazy loading (sometimes) not working in Fluid (only n:1 relations) added