Project

General

Profile

Bug #102105

Updated by John Miller about 1 year ago

This error is being thrown around by the ExtensionManagementUtility::loadBaseTca() function in the loadBaseTca() method of the \TYPO3\CMS\Core\Core\Bootstrap. 

 *Problem* 
 Array values are being checked improperly.  

 Some package TCA files being _required_ in the @\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::buildBaseTcaFromSingleFiles()@ method loops (for both TCA and override TCA) are causing this issue. These TCA files contain keys and even variables whose values are being harvested from non-existent @globals@    multi-dimensional keys. 

 *Example 1:* 
 @vendor/typo3/cms-core/Configuration/TCA/pages.php@ contains this line  
 @['label'=>$GLOBALS['TYPO3_CONF_VARS']['FE']['hidePagesIfNotTranslatedByDefault'] ? 'LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.l18n_cfg.I.2a' : 'LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.l18n_cfg.I.2'],@ 

 If '@hidePagesIfNotTranslatedByDefault@' is not defined, the error is thrown. 

 *Example 2:* 
 @vendor/typo3/cms-core/Classes/Resource/Driver/DriverRegistry.php@ contains this line in its constructor 
 @$driverConfigurations=$GLOBALS['TYPO3_CONF_VARS']['SYS']['fal']['registeredDrivers'];@ 
 which also throws the error if '@registeredDrivers@' is undefined. 

 *Solution* 
 # Predicate optional settings such as the ones mentioned above. In example 1, such as using @isset()@ @isset($GLOBALS['TYPO3_CONF_VARS']['FE']['hidePagesIfNotTranslatedByDefault']) ? ...@ and in example 2, @$driverConfigurations=$GLOBALS['TYPO3_CONF_VARS']['SYS']['fal']['registeredDrivers'] ?? null;@ would be good enough to prevent the error. 
 # Use a the try block in the include closures of the \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::buildBaseTcaFromSingleFiles() method and log or throw out the proper message, such as @"undefined array key 'fal'"@ as it should be with example 2 above in order to know the real problem. 

 *References* 
 # https://stackoverflow.com/questions/16675753/php-fastest-way-to-handle-undefined-array-key

Back