Project

General

Profile

Actions

Bug #91757

closed

Multiple TypoScript conditons are not working.

Added by Karsten Nowak (undkonsorten) over 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2020-07-07
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
10
PHP Version:
7.2
Tags:
typoscript,conditions
Complexity:
Is Regression:
Sprint Focus:

Description

Two or more conditions in a line are not evaluated correctly.

The documentation (https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/TypoScriptSyntax/Syntax/Conditions.html#the-syntax-of-conditions) says:

…the line content gets broken down into smaller units ([ condition 1 ] and [ condition 2 ]) which are individually evaluated and connected by a logical OR before they return the resulting TRUE or FALSE value.

The AbstractConditionMatcher doesn't split multiple conditions.
They just remove the first '[' and the last ']'. Then the whole rest of the string are used to evaluate the expression.

Example:

[1 == 0] || [2 == 2]

This results in checking of following expression in AbstractConditionMatcher method evaluateExpression

1 == 0] || [2 == 2

Normally with the 2==2 the condition should be return "true". But it doesn't.

If I don't write the two ][

[1 == 0 || 2 == 2]

the condition returns true if one of the conditions is true.

I'm not sure where is the bug. In documentation or in code. There are many examples with the wrong syntax if the bug is in the documentation.

I'm wondering that nobody else had the problem. I didn't found the problem on forge or in slack. Maybe I'm searching for the wrong keywords :-).

Actions

Also available in: Atom PDF