[BUGFIX] Check if title is provided before accessing it 65/61165/4
authorGeorg Ringer <georg.ringer@gmail.com>
Fri, 28 Jun 2019 11:49:44 +0000 (13:49 +0200)
committerBenjamin Franzke <bfr@qbus.de>
Wed, 10 Jul 2019 15:44:33 +0000 (17:44 +0200)
If no title is provided for a table in the TCA (ctrl|title),
the wizard for creating new records must not fail with an
exception.

Resolves: #88642
Releases: master, 9.5
Change-Id: Icdda8fdc4e8eb37a09cb8b918fc39b732c28d5b1
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/61165
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Julian Geils <j_geils@web.de>
Tested-by: Benjamin Franzke <bfr@qbus.de>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Julian Geils <j_geils@web.de>
Reviewed-by: Benjamin Franzke <bfr@qbus.de>
typo3/sysext/backend/Classes/Controller/NewRecordController.php

index 4deb48c..691e58c 100644 (file)
@@ -579,12 +579,13 @@ class NewRecordController
                             $_EXTKEY = '';
                             if ($nameParts[0] === 'tx' || $nameParts[0] === 'tt') {
                                 // Try to extract extension name
-                                if (strpos($v['ctrl']['title'], 'LLL:EXT:') === 0) {
-                                    $_EXTKEY = substr($v['ctrl']['title'], 8);
+                                $title = (string)($v['ctrl']['title'] ?? '');
+                                if (strpos($title, 'LLL:EXT:') === 0) {
+                                    $_EXTKEY = substr($title, 8);
                                     $_EXTKEY = substr($_EXTKEY, 0, strpos($_EXTKEY, '/'));
                                     if ($_EXTKEY !== '') {
                                         // First try to get localisation of extension title
-                                        $temp = explode(':', substr($v['ctrl']['title'], 9 + strlen($_EXTKEY)));
+                                        $temp = explode(':', substr($title, 9 + strlen($_EXTKEY)));
                                         $langFile = $temp[0];
                                         $thisTitle = $lang->sL('LLL:EXT:' . $_EXTKEY . '/' . $langFile . ':extension.title');
                                         // If no localisation available, read title from ext_emconf.php