Bug #85630
closedConstant Editor Template matches all conditions
0%
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
Updated by Susanne Moog about 6 years ago
- Target version changed from 8.7.19 to Candidate for patchlevel
Updated by Riccardo De Contardi 5 months ago
- Status changed from New to Needs Feedback
Is this still true on recent TYPO3 versions like 12 or 13?
I did not find the string $matchObj->setSimulateMatchResult(true);
on TYPO3 12; i found on cms-core/Classes/TypoScript/TemplateService.php
the following:
public function generateConfig() { ... $matchObj->setSimulateMatchResult((bool)$this->matchAll); ...
Updated by Garvin Hicking 5 months ago
- Status changed from Needs Feedback to Closed
I am closing this; if I tested it properly this has been already changed through the TypoScript parser redo in T3v12.
If I am mistaken, please report back and I'll re-open!