Project

General

Profile

Bug #93279

Updated by Benjamin Franzke over 3 years ago

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 

 <pre> 
 ( ! ) 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 

 </pre> 


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

 <pre><code class="php"> 
 $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 => [], 
        ]        
    ]    
 ];  
 </code></pre> 

Back