Project

General

Profile

Actions

Bug #102105

closed

Undefined array key "reverseProxyIP"

Added by John Miller 8 months ago. Updated 4 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 #1

Updated by John Miller 8 months ago

  • Description updated (diff)
Actions #2

Updated by John Miller 8 months ago

  • Description updated (diff)
Actions #3

Updated by John Miller 8 months ago

  • Description updated (diff)
Actions #4

Updated by John Miller 8 months ago

  • Description updated (diff)
Actions #5

Updated by Torben Hansen 8 months ago

  • Status changed from New to Needs Feedback

I could not reproduce the described problem on current main.

Both reverseProxyIP and registeredDrivers are part of the TYPO3 default configuration array (see https://github.com/TYPO3/typo3/blob/main/typo3/sysext/core/Configuration/DefaultConfiguration.php) and should always be present, since they are required for TYPO3 to work properly. The default configuration is loaded before TCA is processed and merged with system/additional configuration.

A possible reason for the described error may be, that some extension or system configuration does remove (unset) those array keys, which actually will result in Undefined array key warning.

Adding fallbacks as suggested will most likely resolve the Undefined array key warning, but result in a non-functional TYPO3 installation in affected areas. As an example, if $driverConfigurations=$GLOBALS['TYPO3_CONF_VARS']['SYS']['fal']['registeredDrivers'] ?? [] is added as suggested, then you have no FAL driver at all, which will result in the follow-up exception Desired storage "Local" is not in the list of available storages., since TYPO3 then does not have the expected default FAL driver.

I suggest that you check, if some extension or local setting does unset the required default values somewhere. If you did not find anything which unsets the default array keys in your TYPO3 setup, please provide more information on how to reproduce the problem.

Actions #6

Updated by Riccardo De Contardi 4 months ago

  • Status changed from Needs Feedback to Closed

No feedback within 90 days > I close this issue.

If you think that this is the wrong decision or experience the issue again, please reopen it or open a new issue with a reference to this one.

Thank you.

Actions

Also available in: Atom PDF