Issue Bug Closed

#95716TCA title with plain string crashes NewRecordController

Christian Eßl 10/20/21, 11:31 updated 10/04/22, 14:19

Description

Create a TCA for a table, that is not using a path to a language file (LLL:EXT:…) in ctrl/title, but instead a plain string:

$GLOBALS['TCA']['tx_example'] = [
    'ctrl' => [
        'title'        => 'Bob',
...
    ],
...

If you now click the “Create new record” button in the list module, an exception will be thrown:

(1/1) TypeError
strtok() expects parameter 1 to be string, bool given

This is because in the NewRecordController, the following line assumes a string starting with “LLL:EXT:” and the substr function is returning false:

// Try to get localisation of extension title
$langFile = strtok(substr($title, 9 + strlen($_EXTKEY)), ':');

Reviews 1