From d9e26e4a3bface6a22b83db8d3426d88e11774fa Mon Sep 17 00:00:00 2001 From: John Flatness Date: Mon, 6 Apr 2020 13:14:19 -0400 Subject: [PATCH] Force query cache to not persist between requests (fix #1534) --- application/src/Service/EntityManagerFactory.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/application/src/Service/EntityManagerFactory.php b/application/src/Service/EntityManagerFactory.php index 47b2278396..b2c1f2f15c 100644 --- a/application/src/Service/EntityManagerFactory.php +++ b/application/src/Service/EntityManagerFactory.php @@ -52,10 +52,11 @@ public function __invoke(ContainerInterface $serviceLocator, $requestedName, arr $isDevMode = self::IS_DEV_MODE; } + $arrayCache = new ArrayCache(); if (extension_loaded('apcu') && !$isDevMode) { $cache = new ApcuCache(); } else { - $cache = new ArrayCache(); + $cache = $arrayCache; } // Set up the entity manager configuration. @@ -64,6 +65,10 @@ public function __invoke(ContainerInterface $serviceLocator, $requestedName, arr ); $emConfig->setProxyDir(OMEKA_PATH . '/application/data/doctrine-proxies'); + // Force non-persistent query cache, workaround for issue with SQL filters + // that vary by user, permission level + $emConfig->setQueryCacheImpl($arrayCache); + // Use the underscore naming strategy to preempt potential compatibility // issues with the case sensitivity of various operating systems. // @see http://dev.mysql.com/doc/refman/5.7/en/identifier-case-sensitivity.html