Bug #84070

Updated by Sybille Peters almost 3 years ago

Tested with 9.2.0-dev (current master). 

 If the configured caching backend (e.g. redis) fails because of a misconfiguration or downtime, TYPO3 falls back very nicely to non cached entries.  

 However the RedirectCacheService throws an exception in this case: 


 <pre><code class="php"> 
 Core: Exception handler (WEB): Uncaught TYPO3 Exception:  
 Return value of TYPO3\CMS\Redirects\Service\RedirectCacheService::getRedirects() must be of the type array, boolean returned  
 | TypeError thrown in file  
 /<webroot>/typo3/sysext/redirects/Classes/Service/RedirectCacheService.php in line 60.  
 Requested URL: http://localhost/index.php?id=1 
 </code></pre> 

 "RedirectCacheService.php#60":https://github.com/TYPO3/TYPO3.CMS/blob/61df57efe9284b2a9a26612f7ef2fa1e1019c10b/typo3/sysext/redirects/Classes/Service/RedirectCacheService.php#L60 


 h2. Steps to reproduce 

 # Initial installation with "introduction package" (or without, in this case create a new page with standard root template) 
 # Configure Redis as Caching backend (see configuration snippet below) 
  
 # cause redis backend to fail by stopping the redis service, e.g. service stop redis  
 # (while not logged in in backend): Load frontend pages, e.g. "Get Started" page id=1 

 h2. Results 

 Oops Error / Exception gets thrown.  

 !oops.png! 

 h2. Verify 

 Test without redirect:  

 # deinstall "redirect" extension. There will be no more exceptions, even though redis still isn't available 


 h2. Basic Cache Configuration: 

 *typo3conf/AdditionalConfiguration.php:* 
 <pre><code class="php"> 
 <?php 

 ... 
 @include_once('GeneralConfigurationCache.php'); 
 @setCacheConfigurationRedis(2); 
 </code></pre> 



 *typo3conf/GeneralConfigurationCache.php:* 

 <pre><code class="php"> 
 function setCacheConfigurationRedis($database=false, $names = [ 
         'cache_pages', 
         'cache_pagesection', 
         'cache_hash', 
         'cache_rootline', 
         'cache_imagesizes', 
         'extbase_object', 
         'extbase_reflection', 
         'extbase_typo3dbbackend_queries', 
         'extbase_datamapfactory_datamap', 
         'extbase_object', 
         'extbase_reflection' 
	 ] ) 
 { 

	 if (!$database) { 
		 return; 
	 } 

	 foreach($names as $name) { 
		 $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$name]['backend'] = \TYPO3\CMS\Core\Cache\Backend\RedisBackend::class; 
		 $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$name]['options']['database'] = $database; 
		 // problem with gzuncompress + php-redis 
		 $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$name]['options']['compression'] = false; 

	 } 
 } 

 </code></pre> 

Back