Bug #82499
closed
displayCond - Problem with multiple conditions
Added by Stephan Bauer over 6 years ago.
Updated over 6 years ago.
Description
This displayCond does not work in 8.7.6 but it works in 7.6:
'displayCond' => [
'AND' => [
'OR' => [
'FIELD:protocol:=:0',
'FIELD:protocol:=:2'
],
'OR' => [
'FIELD:type:=:0',
'FIELD:type:=:1'
]
]
],
Do you receive an exception that the syntax is not correct? Could you have a look at the EvaluateDisplayCondition.php file and see what happens? Also, EvaluateDisplayConditionsTest.php, especially method matchConditionStrings() with its data providers in conditionStringDataProvider() does various AND / OR checks. Would you like to have a look at what exactly is going on in this case?
Note: The display condition parser has been rewritten with v8. It is more strict and throws exceptions on syntax errors.
Sorry I forgot this:
#1481464101: With multiple conditions combined by "AND", there must be at least two sub conditions (More information)
RuntimeException thrown in file
/xxx/typo3_src-8.7.6/typo3/sysext/backend/Classes/Form/FormDataProvider/EvaluateDisplayConditions.php in line 213.
This example from the documentation works (https://docs.typo3.org/typo3cms/TCAReference/Columns/ColumnsDisplayCond.html)
'displayCond' => [
'AND' => [
'FIELD:sys_language_uid:<=:0',
'OR' => [
'FIELD:CType:=:text',
'FIELD:spaceBefore:>:0'
]
]
];
Hello Chrisitan,
unfortunatelly there is no test in EvaluateDisplayConditionsTest.php for my case.
I am amazed if this actually worked (and did what you expected) in TYPO3 7.6 given that PHP is the one to screw you. You can't have two identical text keys in an array, the latter one will replace the former one. The difference now is that the evaluation detects that there's a problem while it was silently "failing" (or doing unexpected things) in previous versions:
$condTest = [
'displayCond' => [
'AND' => [
'OR' => [
'FIELD:protocol:=:0',
'FIELD:protocol:=:2'
],
'OR' => [
'FIELD:type:=:0',
'FIELD:type:=:1'
]
]
]
];
var_dump($condTest);
array(1) {
["displayCond"]=>
array(1) {
["AND"]=>
array(1) {
["OR"]=>
array(2) {
[0]=>
string(14) "FIELD:type:=:0"
[1]=>
string(14) "FIELD:type:=:1"
}
}
}
}
- Status changed from New to Needs Feedback
- Status changed from Needs Feedback to Closed
Considering the latest comment from Morton Jonuschat, I think that it should be safe to close this one; if it worked before, it was because the code silently failed or was behaving in a wrong way (so it worked fortuitously).
Moreover, there has been no activity on this issue since a while (>90 days).
If you think that this is the wrong decision , please reopen it or open a new issue with a reference to this one with an explanation of your point of view. Thank you and sorry for the late answer.
- Related to Bug #90768: Flexform nested displayCond added
Also available in: Atom
PDF