Bug #87899

Magic getters stop to be evaluated in Fluid starting from TYPO3 9

Added by Felix Althaus over 2 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Fluid
Target version:
-
Start date:
2019-03-13
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
9
PHP Version:
7.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

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 issues

Related to TYPO3 Core - Task #82229: Remove extended fluid core classClosedBenni Mack2017-08-28

Actions
Related to TYPO3 Core - Bug #90215: Getters of class LazyLoadingProxy can't be called by FluidAccepted2020-01-27

Actions
Related to TYPO3 Core - Bug #87651: Lazy loading (sometimes) not working in Fluid (only n:1 relations)Closed2019-02-05

Actions
#1

Updated by Susanne Moog over 2 years ago

  • Category set to Fluid
#2

Updated by Claus Due over 2 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.

#3

Updated by Anja Leichsenring over 2 years ago

  • Related to Task #82229: Remove extended fluid core class added
#4

Updated by Felix Althaus over 2 years ago

I created a PR on github: https://github.com/TYPO3/Fluid/pull/438

#5

Updated by Susanne Moog over 2 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.

#6

Updated by Felix Althaus over 2 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.

#7

Updated by Ralph Brugger over 1 year ago

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!

#8

Updated by Stephan Großberndt 11 months ago

  • Related to Bug #90215: Getters of class LazyLoadingProxy can't be called by Fluid added
#9

Updated by Stephan Großberndt 11 months ago

  • Related to Bug #87651: Lazy loading (sometimes) not working in Fluid (only n:1 relations) added

Also available in: Atom PDF