Project

General

Profile

Actions

Bug #102105

closed

Undefined array key "reverseProxyIP"

Added by John Miller 9 months ago. Updated 6 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2023-10-06
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
13
PHP Version:
8.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

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
  1. 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'] ?? []; would be good enough to prevent the error.
  2. 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
  1. https://stackoverflow.com/questions/16675753/php-fastest-way-to-handle-undefined-array-key
Actions

Also available in: Atom PDF