Bug #100563
closed
Unable to get property "type" of non-object "getTSFE()" in TYPO3 12.4.0-dev when using condition getTSFE().type in backend context
Added by Alex Kellner over 1 year ago.
Updated 5 months ago.
Description
I just updated from TYPO3 12.2 to 12.4.0-dev and faced an issue in LUXletter when opening the own backend module.
This seems to be related to this TypoScript:
[getTSFE().type == 1562349004]
...
[end]
Playing with [traverse(page,'type') == 1562349004] but this seems not to work in frontend.
Any help for me here?
Related to: https://github.com/in2code-de/luxletter/issues/174
Is this triggered by extbase BackendConfigurationManager? Could you provide the full backtrace? We may need to adapt extbase in this case a bit.
- Status changed from New to Needs Feedback
- Status changed from Needs Feedback to Under Review
- Related to Task #100237: Deprecate two TypoScript related Exceptions added
Hi Alex,
this is most probably due to the changes in #100237. Those changes were necessary after cleaning up the whole expression language implementation in #100047. You have to adjust your TypoScript to check for TSFE
being available. Previously, the whole condition evaluated to FALSE
if TSFE
was not available, e.g. in backend context. Since #100237 however, the function (getTSFE()
) itself returns FALSE
in case TSFE
is not available. To prevent the corresponding exception, the following check has to be used: [getTSFE() && getTSFE().type 1562349004]
.
I now created a patch which aligns the behaviour of getTSFE()
to return NULL
instead of FALSE
. This allows to also use the null-safe operator ?
. You will then be able to use [getTSFE()?.type 1562349004]
. This is in line with the other expresion functions, like site
or siteLanguage
.
I hope this helps and I'm sorry for the inconveniences.
Best, Oli
Thx for digging into it.
I think a change to:
[getTSFE() && getTSFE().type == 1562349004]
...
Should do it for now
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
- Related to Task #100672: Correct examples around getTSFE() in changelogs added
- Status changed from Resolved to Closed
Also available in: Atom
PDF