Bug #85630

Constant Editor Template matches all conditions

Added by Rozbeh Chiryai Sharahi about 1 year ago. Updated about 1 year ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Backend User Interface
Start date:
2018-07-24
Due date:
% Done:

0%

TYPO3 Version:
8
PHP Version:
7.1
Tags:
Complexity:
medium
Is Regression:
No
Sprint Focus:

Description

Hello TYPO3 Community,

i was these days facing a weird problem until i found out the reason for it. I'm not sure if this is done on purpose, so might also be a weird feature.

When using conditions in a constants.ts template you will (after a long time) realize that all typoscript conditions match, which will cause the last statement of a constant to be always shown as default/fallback value in constant editor.

Example:

[applicationContext = Production/Stage]
  some.var = stage
[global]

[applicationContext = Production/Live]
  some.var = live
[global]

[applicationContext = Development]
  some.var = dev
[global]

When it comes to the frontend everything will be fine and "some.var" will be different depending on applicationContext. But when it comes to the constant editor in the backend it will show always "live", since for some reason all conditions match. This is caused by following:

/typo3/cms/typo3/sysext/core/Classes/TypoScript/ExtendedTemplateService.php on line 341 in "generateConfig_constants" where it calls: 

$matchObj->setSimulateMatchResult(true);

By commenting this line out you will get the correct result in the backend.

This might have the reason, that there could be conditions that are only matchable in frontend like GP:L = 2 and this might get confusing then in backend context. Still i think that it brings 300% more confusion if we just take the last statement not matter what condition :/

What do you think about removing this line?

Kind regards
Rozbeh Chiryai Sharahi

History

#1 Updated by Susanne Moog about 1 year ago

  • Target version changed from 8.7.19 to Candidate for patchlevel

Also available in: Atom PDF