Bug #82499
closeddisplayCond - Problem with multiple conditions
0%
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' ] ] ],
Updated by Christian Kuhn over 6 years ago
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?
Updated by Christian Kuhn over 6 years ago
Note: The display condition parser has been rewritten with v8. It is more strict and throws exceptions on syntax errors.
Updated by Stephan Bauer over 6 years ago
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' ] ] ];
Updated by Stephan Bauer over 6 years ago
Hello Chrisitan,
unfortunatelly there is no test in EvaluateDisplayConditionsTest.php for my case.
Updated by Morton Jonuschat over 6 years ago
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" } } } }
Updated by Mona Muzaffar over 6 years ago
- Status changed from New to Needs Feedback
Updated by Riccardo De Contardi over 6 years ago
- 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.
Updated by Georg Ringer about 4 years ago
- Related to Bug #90768: Flexform nested displayCond added