Autoloader should not check for file existence
authorAlexander Ebert <ebert@woltlab.com>
Wed, 13 Mar 2019 12:14:37 +0000 (13:14 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 13 Mar 2019 12:14:37 +0000 (13:14 +0100)
wcfsetup/install/files/lib/system/WCF.class.php

index c8d57dd717d17e864e2c8f9e597ab34463a87de3..ae237084346dadd20841f583735e009de748f38e 100644 (file)
@@ -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);
                        }
                }
        }