From 2de9fb40fa21a19ceb1aaf098570ccbb6db7c06b Mon Sep 17 00:00:00 2001 From: tbringewatt <t.bringewatt@mittwald.de> Date: Fri, 3 Feb 2017 15:45:02 +0100 Subject: [PATCH] [TASK] Do not throw exception on unavailable APC(u) cache backend MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Log an error (keeping the website available) instead of throwing an exception (and thus completely disabling it) if TYPO3 is configured to use the APC / APCu cache backend but saving data to the cache failed. Resolves: #79636 Releases: master, 8.7 Change-Id: I3adf829825017a3061e921d5d3ec74f20e18311e Reviewed-on: https://review.typo3.org/51521 Reviewed-by: Stephan Großberndt <stephan@grossberndt.de> Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de> Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Alexander Opitz <opitz.alexander@googlemail.com> Tested-by: Alexander Opitz <opitz.alexander@googlemail.com> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> --- typo3/sysext/core/Classes/Cache/Backend/ApcBackend.php | 5 ++++- typo3/sysext/core/Classes/Cache/Backend/ApcuBackend.php | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/typo3/sysext/core/Classes/Cache/Backend/ApcBackend.php b/typo3/sysext/core/Classes/Cache/Backend/ApcBackend.php index dd51ab2f2d66..dc6cfa288753 100644 --- a/typo3/sysext/core/Classes/Cache/Backend/ApcBackend.php +++ b/typo3/sysext/core/Classes/Cache/Backend/ApcBackend.php @@ -14,6 +14,8 @@ namespace TYPO3\CMS\Core\Cache\Backend; * The TYPO3 project - inspiring people to share! */ +use TYPO3\CMS\Core\Utility\GeneralUtility; + /** * A caching backend which stores cache entries by using APC. * @@ -144,7 +146,8 @@ class ApcBackend extends \TYPO3\CMS\Core\Cache\Backend\AbstractBackend implement $this->removeIdentifierFromAllTags($entryIdentifier); $this->addIdentifierToTags($entryIdentifier, $tags); } else { - throw new \TYPO3\CMS\Core\Cache\Exception('Could not set value.', 1232986877); + $errorMessage = 'Error using APCu: Could not save data in the cache.'; + GeneralUtility::sysLog($errorMessage, 'core', GeneralUtility::SYSLOG_SEVERITY_ERROR); } } diff --git a/typo3/sysext/core/Classes/Cache/Backend/ApcuBackend.php b/typo3/sysext/core/Classes/Cache/Backend/ApcuBackend.php index 445d5cbabba7..3e550b13bd4b 100644 --- a/typo3/sysext/core/Classes/Cache/Backend/ApcuBackend.php +++ b/typo3/sysext/core/Classes/Cache/Backend/ApcuBackend.php @@ -13,6 +13,7 @@ namespace TYPO3\CMS\Core\Cache\Backend; * * The TYPO3 project - inspiring people to share! */ + use TYPO3\CMS\Core\Cache; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -145,7 +146,8 @@ class ApcuBackend extends AbstractBackend implements TaggableBackendInterface $this->removeIdentifierFromAllTags($entryIdentifier); $this->addIdentifierToTags($entryIdentifier, $tags); } else { - throw new Cache\Exception('Could not set value.', 1232986277); + $errorMessage = 'Error using APCu: Could not save data in the cache.'; + GeneralUtility::sysLog($errorMessage, 'core', GeneralUtility::SYSLOG_SEVERITY_ERROR); } } -- GitLab