From a2439dec02b6ff1cdae59385e79b63c08c74b1cd Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 2 Aug 2016 11:42:05 +0200 Subject: [PATCH] fix "PHP Fatal error: APCuIterator::__construct(): APC must be enabled to use" in setup-cli --- api/src/Cache/Apcu.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/api/src/Cache/Apcu.php b/api/src/Cache/Apcu.php index f18f9c998a..e39ef5acd7 100644 --- a/api/src/Cache/Apcu.php +++ b/api/src/Cache/Apcu.php @@ -151,6 +151,11 @@ class Apcu extends Base implements Provider */ function flush(array $keys) { + // do NOT try instanciating APCuIterator, if APCu is not enabled, as it gives a PHP Fatal Error + if (!ini_get('apc.enabled') || php_sapi_name() === 'cli' && !ini_get('apc.cli_enabled')) + { + return false; + } if (!$keys && function_exists('apcu_clear_cache')) { apcu_clear_cache();