Bug #82499

displayCond - Problem with multiple conditions

Added by Stephan Bauer over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2017-09-17
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
8
PHP Version:
7.1
Tags:
Complexity:
Is Regression:
Sprint Focus:

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'
                    ]
                ]
            ],


Related issues

Related to TYPO3 Core - Bug #90768: Flexform nested displayCondClosed2020-03-16

Actions
#1

Updated by Christian Kuhn over 4 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?

#2

Updated by Christian Kuhn over 4 years ago

Note: The display condition parser has been rewritten with v8. It is more strict and throws exceptions on syntax errors.

#3

Updated by Stephan Bauer over 4 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'
        ]
    ]
];

#4

Updated by Stephan Bauer over 4 years ago

Hello Chrisitan,
unfortunatelly there is no test in EvaluateDisplayConditionsTest.php for my case.

#5

Updated by Morton Jonuschat over 4 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" 
      }
    }
  }
}
#6

Updated by Mona Muzaffar over 4 years ago

  • Status changed from New to Needs Feedback
#7

Updated by Riccardo De Contardi over 4 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.

#8

Updated by Georg Ringer about 2 years ago

  • Related to Bug #90768: Flexform nested displayCond added

Also available in: Atom PDF