diff --git a/services/nginx/app/index.php b/services/nginx/app/index.php index 53b1ef5f..ae2462d2 100644 --- a/services/nginx/app/index.php +++ b/services/nginx/app/index.php @@ -83,12 +83,14 @@ spl_autoload_register(function (string $class): void { if (defined('redis')) { try { $cached = redis->get($cache_key); - if (is_string($cached) && $cached !== '' && is_file($cached) && $isPathInside($cached, $wdReal)) { - require_once $cached; - if ($is_loaded($class)) { - return; + if (is_string($cached) && $cached !== '' && is_file($cached)) { + if ($isPathInside($cached, $wdReal)) { + require_once $cached; + if ($is_loaded($class)) { + return; + } } - // Stale class mapping in cache, continue with normal lookup. + // Stale, invalid, or unsafe class mapping in cache; continue with normal lookup. redis->delete($cache_key); } elseif (is_string($cached) && $cached !== '') { // Remove non-existing cached path to avoid repeated failed lookups.