Bug #91259
closed
New symfony expression syntax provides no replacement for [else] and does not document this removal either
Added by Stefanos Karasavvidis almost 4 years ago.
Updated about 3 years ago.
Description
I'm on TYPO3 10.4.1 and try to use a typoscript condition with ELSE part. The following is a sample to the default typoscript setup section of a new installation
page.20 = TEXT
[{$someconstant} > 50]
page.20.value = IN FIRST
[ELSE]
page.20.value = IN ELSE
[END]
If someconstant is indeed > 50, everything is fine. If someconstant is less than 50, the condition works, but in the TYPO3 log I get
Expression could not be parsed. - {"expression":"ELSE"}
which is confusing as it suggests that something is wrong
- Status changed from New to Needs Feedback
I've tested your example in 10.4.1 and master and both are logging this error.
- Status changed from Needs Feedback to Accepted
- Subject changed from Confusing error message with typoscript ELSE conditions "Expression could not be parsed. - {"expression":"ELSE"}" to New symfony expression syntax provides no replacement for [else] and does not document this removal either
- Priority changed from Should have to Must have
- TYPO3 Version changed from 10 to 9
- Is Regression set to Yes
This is because [else]
does not exist as Symfony expression. It was silently dropped without further notice (like so many thinks these days). If you enabled strict syntax in TYPO3 9 then this was already marked as deprecated (without hint to any replacement).
A very ugly workaround is to write
[end]
[negatedCondition]
as an replacment for [else]
.
I really do not know whether the documentation is wrong or the error message. What I can confirm is that the condition from the bug report does work as it should. It just produces the error message. However, it may work only because of some weird parsing error.
- Status changed from Accepted to Under Review
I am now confused with the latest patch.
The patch description suggests that the [ELSE] statement in typoscript is still supported, and the patch just removes the warning.
The Subject of this ticket suggests that [ELSE] is no longer supported, and typoscript should be changed using a negated condition.
So which is true? If [ELSE] is still supported, the Subject of this ticket should be changed again.
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
- Status changed from Resolved to Closed
Also available in: Atom
PDF