aboutsummaryrefslogtreecommitdiffstats
path: root/core/application.php
diff options
context:
space:
mode:
authorThomas Lange <code@nerdmind.de>2021-08-29 00:33:20 +0200
committerThomas Lange <code@nerdmind.de>2021-08-29 00:49:11 +0200
commit2738a6d20ebde5da0d8eb96c6c2b2cc30750245a (patch)
tree6b21ab87e03682558ff87d49dffc1568033959f3 /core/application.php
parent2b3c8d5ced70ace627439919df870c1d40d62e0e (diff)
downloadblog-2738a6d20ebde5da0d8eb96c6c2b2cc30750245a.tar.gz
blog-2738a6d20ebde5da0d8eb96c6c2b2cc30750245a.tar.xz
blog-2738a6d20ebde5da0d8eb96c6c2b2cc30750245a.zip
Check for "is_file" in the SPL class autoloader
Diffstat (limited to 'core/application.php')
-rw-r--r--core/application.php12
1 files changed, 8 insertions, 4 deletions
diff --git a/core/application.php b/core/application.php
index 8d0b8a3..cb2e5b2 100644
--- a/core/application.php
+++ b/core/application.php
@@ -21,11 +21,15 @@ if(!version_compare(PHP_VERSION, '7.3', '>=')) {
define('ROOT', dirname(__DIR__).'/');
#===============================================================================
-# Autoload register for classes
+# Register autoloader for classes
#===============================================================================
-spl_autoload_register(function($classname) {
- $classname = str_replace('\\', '/', $classname);
- require "namespace/{$classname}.php";
+spl_autoload_register(function($className) {
+ $classPath = str_replace('\\', '/', $className);
+ $classPath = ROOT."core/namespace/{$classPath}.php";
+
+ if(is_file($classPath)) {
+ require $classPath;
+ }
});
#===============================================================================