From 5850bfbce7219df0b56bff0728d3c28d50c437af Mon Sep 17 00:00:00 2001 From: Jeppe B <2jepp9350@gmail.com> Date: Tue, 2 Jun 2026 01:16:20 +0200 Subject: [PATCH] Keep autoload cache validation test compatible --- services/nginx/app/index.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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.