Project

General

Profile

Actions

Bug #93279

closed

ErrorHandler is registered before it has actually been fully configured (missing dependencies)

Added by Benjamin Franzke over 3 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
System/Bootstrap/Configuration
Target version:
Start date:
2021-01-12
Due date:
% Done:

100%

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

Description

The core ErrorHandler registeres the error handler in construct.
Now, because it implements LoggerAwareInterface, GeneralUtility::makeInstance will try to create a logger after the object (ErrorHandler) has been constructed. That means the error handler is active, while the logger is being created.

Now, when an exception during logger creation happens, the incomplete ErrorHandler is invoked.
This then causes an exception like:

Exception initially reported on Slack by Franz Holzinger with TYPO3 v9.5.24: https://typo3.slack.com/archives/C025BQLFA/p1610482539284400

( ! ) Fatal error: Uncaught TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException: A cache with identifier "assets" does not exist. in /[…]/htdocs/typo3/sysext/core/Classes/Cache/CacheManager.php on line 138
( ! ) TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException: A cache with identifier "assets" does not exist. in /[…]/htdocs/typo3/sysext/core/Classes/Cache/CacheManager.php on line 138
Call Stack
#    Time    Memory    Function    Location
1    0.0000    397120    {main}( )    .../htdocs/index.php:0
2    0.0001    397440    {closure:/[…]/index.php:21-25}( )    .../index.php:25
3    0.0019    516832    TYPO3\CMS\Core\Core\Bootstrap::init( )    .../index.php:24
4    0.0029    648224    TYPO3\CMS\Core\Core\Bootstrap::initializeErrorHandling( )    .../Bootstrap.php:105
5    0.0029    648224    TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( )    .../Bootstrap.php:705
6    0.0031    651184    TYPO3\CMS\Core\Log\LogManager->getLogger( )    .../GeneralUtility.php:3695
7    0.0031    651376    TYPO3\CMS\Core\Log\LogManager->setWritersForLogger( )    .../LogManager.php:103
8    0.0031    651752    TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( )    .../LogManager.php:145
9    0.0033    654248    TYPO3\CMS\Core\Log\Writer\FileWriter->__construct( )    .../GeneralUtility.php:3689
10    0.0033    654376    TYPO3\CMS\Core\Log\Writer\FileWriter->setLogFile( )    .../FileWriter.php:82
11    0.0033    654376    TYPO3\CMS\Core\Log\Writer\FileWriter->openLogFile( )    .../FileWriter.php:123
12    0.0034    654752    fopen ( )    .../FileWriter.php:194
13    0.0034    656024    TYPO3\CMS\Core\Error\ErrorHandler->handleError( )    .../FileWriter.php:194
14    0.0035    666992    TYPO3\CMS\Core\TimeTracker\TimeTracker->setTSlogMessage( )    .../ErrorHandler.php:156
15    0.0036    667048    TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( )    .../TimeTracker.php:219
16    0.0036    668224    TYPO3\CMS\Core\Imaging\IconFactory->__construct( )    .../GeneralUtility.php:3689
17    0.0036    668224    TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( )    .../IconFactory.php:65
18    0.0036    670704    TYPO3\CMS\Core\Imaging\IconRegistry->__construct( )    .../GeneralUtility.php:3689
19    0.0036    670704    TYPO3\CMS\Core\Imaging\IconRegistry->initialize( )    .../IconRegistry.php:494
20    0.0037    670704    TYPO3\CMS\Core\Imaging\IconRegistry->getCachedBackendIcons( )    .../IconRegistry.php:514
21    0.0037    737544    TYPO3\CMS\Core\Cache\CacheManager->getCache( )    .../IconRegistry.php:540

The exception can be reproduced with an invalid logger configuration like:

$GLOBALS['TYPO3_CONF_VARS']['LOG'] = [
   'writerConfiguration' => [
       \TYPO3\CMS\Core\Log\LogLevel::DEBUG => null,
       \TYPO3\CMS\Core\Log\LogLevel::WARNING => [
           \TYPO3\CMS\Core\Log\Writer\SyslogWriter::class => [],
       ]       
   ]   
]; 
Actions #1

Updated by Gerrit Code Review over 3 years ago

  • Status changed from New to Under Review

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/67440

Actions #2

Updated by Benjamin Franzke over 3 years ago

  • Description updated (diff)
Actions #3

Updated by Benni Mack about 3 years ago

  • Target version changed from 11.1 to 11.2
Actions #4

Updated by Gerrit Code Review about 3 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/67440

Actions #5

Updated by Gerrit Code Review about 3 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/67440

Actions #6

Updated by Gerrit Code Review about 3 years ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/67440

Actions #7

Updated by Benni Mack almost 3 years ago

  • Target version changed from 11.2 to 11.3
Actions #8

Updated by Gerrit Code Review almost 3 years ago

Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/67440

Actions #9

Updated by Gerrit Code Review almost 3 years ago

Patch set 1 for branch 10.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/69119

Actions #10

Updated by Gerrit Code Review almost 3 years ago

Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/69120

Actions #11

Updated by Benjamin Franzke almost 3 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #12

Updated by Benni Mack almost 3 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF