Breaking: #97816 - TypoScript syntax changes

See forge#97816



The new TypoScript parser is currently not or only partially active in the system. The full implementation should be finished until v12 LTS. This note should be removed later.

TYPO3 v12 comes with a new TypoScript syntax parser that is more performant, more robust and allows better tooling in the Backend.

The new parser is more forgiving in many places, but some seldom used syntax details have been removed, too. This documentation explains details that may be breaking for existing instances.

Also see the feature documentation for an overview of syntax improvements.


Using one of the constructs below stops working in v12 and needs TypoScript adaptions.

Affected installations

Instances using TypoScript as outlined below.


Streamlined constants usage

It has never been fully documented in which context "constants" {$foo} shall be used and which exact capabilities they have. The main TypoScript constants documentation within the TypoScript Reference was partially outdated, and the TSconfig documentation claimed TSconfig is not constants aware at all, which isn't fully the case anymore. Let's sort out some details:

  • Nesting constants is not possible and never has been. A construct like this is invalid syntax and is treated as string literal: {$foo{$bar}}

  • 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.

    foo = fooValue
    # This does not resolve to "fooValue" but is kept as string literal "{$foo}"
    bar = {$foo}
    # This does NOT resolve to "fooValue", but to the string literal "{$foo}"
    myValue = {$bar}
  • Constants are now restricted to "assignments" and "conditions". Using a constant to substitute an "identifier" / "object path" is no longer allowed. This has never been clarified in the docs before and instances abusing constants to specify object paths should be seldom and need to resolve the situation with the new parser now:

    This is supported:

    # Simple constant usage as assignment value:
    foo = {$bar}
    # Compiling a value with string literals and constants:
    foo = I am {$bar}
    # Using a constant in a condition:
    [ myValue = {$bar} ]
    # Using constant(s) in multiline assginments:
    foo (
       I am {$bar} and {$baz}

    These constructs are not supported:

    # Using a constant as object path specification
    {$bar} = myValue
    # This is an object path specification, too, and not supported:
    foo < {$bar}
  • TSconfig does support constant substitution: Site constants can be used in TSconfig. This has been introduced with TYPO3 v10, see Feature: #91080 - Site settings as TypoScript constants and in TSconfig for details.

UTF-8 BOM in TypoScript files

The new TypoScript parser no longer ignores UTF-8 BOM in included files: Having a Byte-order-mark in TypoScript files may create undesired results. They should be removed. UTF-8 BOM is disallowed in various other languages, for instance JSON and PHP. The new parser follows here. Modern editors typically don't add an UTF-8 BOM anymore.

Instances can check if they use UTF-8 BOM with a Unix shell command:

# find affected files
find . -type f -print0 | xargs -0 -n1 file {} | grep 'UTF-8 Unicode (with BOM)'
# remove UTF-8 BOM from a single file
sed -i '1s/^\xEF\xBB\xBF//' affectedFile.typoscript

Support for n and rn linebreaks only

TypoScript sources must terminate single lines with either "n" (Unix ending: LineFeed), or "rn" (Windows ending: Carriage return, LineFeed). Ancient Mac, prior to Mac OS X used "r" as single linebreak character. This old linebreak type is no longer detected when parsing TypoScript and may lead to funny results, but chances are very low any instance is affected by this.