Bug #99377
closed
Constant substitution not working
Added by Roman Büchler over 1 year ago.
Updated about 1 year ago.
Description
Using the following typoscript constants
test {
a = Hi
b = {$test.a} everybody
}
with the following typoscript setup
page.1 = TEXT
page.1.value = {$test.b}!
produced until TYPO3 v11 the following output:
Hi everybody!
With TYPO3 v12.1 the substitution from a constant used in a constant doesn't work any more and as a result the following will be rendered:
{$test.a} everybody!
- Status changed from New to Accepted
- Status changed from Accepted to Rejected
I'm afraid v12 does not support constants in constants. This has been documented as breaking:
https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/12.0/Breaking-97816-TypoScriptSyntaxChanges.html#streamlined-constants-usage
Recursive constants were possible with the old parser but are not supported
with the new parser anymore. This was never documented, the Backend Template
module never showed them as resolved, only the Frontend parsed recursive constants.
The simple rule is now: Never access a constant within another constant.
Instances using a construct like the below one need to untie constants.
constants:
foo = fooValue
# This does not resolve to "fooValue" but is kept as string literal "{$foo}"
bar = {$foo}
It might be possible to scan for this in my upcoming syntax checker, though. the "template analyzer / Include tree" will then show such violations.
Ok, where would you kick in to solve that? we have tons of projects using that functionality and this will cause have hefti migration problems.
Also available in: Atom
PDF