Keep autoload cache validation test compatible

This commit is contained in:
Jeppe B
2026-06-02 01:16:20 +02:00
parent fd51a5b119
commit 5850bfbce7
+7 -5
View File
@@ -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.