Issue Bug Resolved

#110701TypoScript code-completion crashes with TypeError on a trailing escaped dot in a key

Anton Danilov 09/14/26, 14:23 updated 11/11/26, 14:10

Description

A TypeError is thrown from the TypoScript code-completion AJAX endpoint whenever a page’s merged TypoScript contains a scalar value stored under a key whose identifier ends in a dot. A realistic trigger is a CASE selector key with a trailing literal dot:

lib.foo = CASE
lib.foo {
    Mr\. = TEXT
    Mr\. {
        value = Sehr geehrter Herr
    }
}
Core: Exception handler (WEB): Uncaught TYPO3 Exception: TYPO3\CMS\Backend\Controller\CodeEditor\CodeCompletionController::treeWalkCleanup(): Argument #1 ($treeBranch) must be of type array, string given, called in .../typo3/sysext/backend/Classes/Controller/CodeEditor/CodeCompletionController.php on line 110 Requested URL: /typo3/ajax/code-editor/codecompletion/load-templates?pageId=151

*Reproduction*
1. Log in as admin, open TypoScript module on a page and edit the `sys_template` Setup/Constants field.
2. The AJAX call fires automatically on editor init (not only on Ctrl+Space).
3. Include the CASE snippet above in any template up the page’s rootline.
4. The request 500s and writes a `TypeError` to the log.

Root cause

if (substr($key, -1) !== '.') {
    // value-assignment branch
} else {
    $subBranch = $this->treeWalkCleanup($value); // assumes $value is an array
}

When the key ends in ., the code assumes the value is an array and recurses, but RootNode::toArray() / AbstractChildNode::toArray() place a string under a dotted key (the trailing-escaped-dot case). Passing that string to the array-typed $treeBranch throws the TypeError. The recursion guard is keyed on the key suffix while assuming the value type – a mismatch that crashes instead of skipping the malformed node.

Reviews 2

History 39

  1. Gerrit Code Review pushed patch set 1 for main to change 95812 status New Under Review 09/14/26, 14:29

  2. Anton Danilov changed Related to #84534 09/14/26, 14:30

  3. Gerrit Code Review pushed patch set 2 for main to change 95812 10/22/26, 15:09

  4. Gerrit Code Review pushed patch set 3 for main to change 95812 11/10/26, 18:36

  5. Gerrit Code Review pushed patch set 1 for 14.3 to change 97540 11/11/26, 13:13

  6. Gerrit Code Review pushed patch set 2 for 14.3 to change 97540 11/11/26, 13:14

  7. Anton Danilov commented and changed status Under Review Resolved done 0 % 100 % 11/11/26, 13:20

    Applied in changeset commit:a9fd86269a0e39110a2cfaa5b9ea150f5a3d9cb7.

  8. Gerrit Code Review pushed patch set 3 for 14.3 to change 97540 status Resolved Under Review 11/11/26, 13:46

  9. Anton Danilov commented and changed status Under Review Resolved 11/11/26, 14:10

    Applied in changeset commit:b0c09a9bf59a8255703f2c437390d84197ea5515.