From 6462fc33a4b28d269709e4ffd2d5d05bb5d15942 Mon Sep 17 00:00:00 2001 From: Gunnstein Lye Date: Mon, 13 Aug 2018 16:11:50 +0200 Subject: [PATCH] EZP-29034: Cannot install ezplatform on 1.7 branch (#317) * [Cache] Skip class cache on PHP 7 like Symfony 3.x does by default On PHP 7 in combination with composer optimized aultoad, class cache does not provide any speed benefit anylonger. Only downsides like code breaking on interface changes when doing composer update or deploying new code on old cache. Addtional benefit whith this is for platform.sh where cache is currently placed on shared mount, meaning: - This change will likly speed up p.sh installs - Tiny bit less files on cache mount to clear - The issue mentioned above, given deployes shares cache will be avoided At least for class cache, there are still similar issues in rare cases on proxies generated for lazy services. (cherry picked from commit 5fdf60c698760eda387286d5885ffe67ee32191f) * Disable bootstrap.php.cache on PHP 7 --- web/app.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/web/app.php b/web/app.php index 3cf1f61511..a5865e164f 100644 --- a/web/app.php +++ b/web/app.php @@ -18,12 +18,12 @@ $useDebugging = $environment === 'dev'; } -// Depending on SYMFONY_CLASSLOADER_FILE use custom class loader, otherwise use bootstrap cache, or autoload in debug +// Depending on SYMFONY_CLASSLOADER_FILE use custom class loader, otherwise use normal autoload and optionally bootstrap cache on PHP 5 when not in debug mode if ($loaderFile = getenv('SYMFONY_CLASSLOADER_FILE')) { require_once $loaderFile; } else { require_once __DIR__ . '/../app/autoload.php'; - if (!$useDebugging) { + if (!$useDebugging && PHP_VERSION_ID < 70000) { require_once __DIR__ . '/../app/bootstrap.php.cache'; } } @@ -36,8 +36,9 @@ $kernel = new AppKernel($environment, $useDebugging); -// we don't want to use the classes cache if we are in a debug session -if (!$useDebugging) { +// we don't want to use the class cache if we are in a debug session +// Also not on PHP7+ where it does not give benefit (if using composer optimize autoload), only downsides remains +if (!$useDebugging && PHP_VERSION_ID < 70000) { $kernel->loadClassCache(); }