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. Anton Danilov commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-11-11T13:20:11+00:00" > 11/11/26, 13:20 </span>

    Applied in changeset commit:a9fd86269a0e39110a2cfaa5b9ea150f5a3d9cb7.

  2. Gerrit Code Review pushed patch set 3 for 14.3 to change 97540 status Resolved Under Review <span data-processor="relativetime" data-value="2026-11-11T13:46:50+00:00" > 11/11/26, 13:46 </span>

  3. Anton Danilov commented and changed status Under Review Resolved <span data-processor="relativetime" data-value="2026-11-11T14:10:03+00:00" > 11/11/26, 14:10 </span>

    Applied in changeset commit:b0c09a9bf59a8255703f2c437390d84197ea5515.