From 6f609fecc3864d2aa06dcb66d92902f53c95adb7 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 13 Mar 2019 13:14:37 +0100 Subject: [PATCH] Autoloader should not check for file existence --- wcfsetup/install/files/lib/system/WCF.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/wcfsetup/install/files/lib/system/WCF.class.php b/wcfsetup/install/files/lib/system/WCF.class.php index c8d57dd717..ae23708434 100644 --- a/wcfsetup/install/files/lib/system/WCF.class.php +++ b/wcfsetup/install/files/lib/system/WCF.class.php @@ -789,9 +789,10 @@ class WCF { } if (isset(self::$autoloadDirectories[$applicationPrefix])) { $classPath = self::$autoloadDirectories[$applicationPrefix] . implode('/', $namespaces) . '.class.php'; - if (file_exists($classPath)) { - require_once($classPath); - } + + // PHP will implicitly check if the file exists when including it, which means that we can save a + // redundant syscall/fs access by not checking for existence ourselves. Do not use require_once()! + @include_once($classPath); } } } -- 2.20.1