Project

General

Profile

Actions

Bug #97888

closed

Undefined array key access in LogManager

Added by Francois Suter over 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Logging
Target version:
Start date:
2022-07-11
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
11
PHP Version:
8.0
Tags:
Complexity:
no-brainer
Is Regression:
Sprint Focus:

Description

The \TYPO3\CMS\Core\Log\LogManager::getConfigurationForLogger() method accesses $GLOBALS['TYPO3_CONF_VARS']['LOG'] without checking if it really exists. Any array access should be hardened, considering PHP 8+.

It may seem unlikely that $GLOBALS['TYPO3_CONF_VARS']['LOG'] should be empty, but you never know. In my case, it happened when writing unit tests for a class which uses the LoggerAwareTrait. The Logger gets instantiated and thus tries to access the corresponding configuration, which doesn't exist when unit testing.

Actions

Also available in: Atom PDF