From: Andrew Dolgov Date: Wed, 18 Jul 2018 10:25:18 +0000 (+0300) Subject: autoloader: check if class name is namespaced before trying to split it X-Git-Tag: 18.8~11 X-Git-Url: https://git.wh0rd.org/?p=tt-rss.git;a=commitdiff_plain;h=a2d1fa5b14104013bab8ca4d9d5e115ebedaab42 autoloader: check if class name is namespaced before trying to split it --- diff --git a/include/autoload.php b/include/autoload.php index 2e73a972..1f1dbe5e 100644 --- a/include/autoload.php +++ b/include/autoload.php @@ -2,7 +2,11 @@ require_once "functions.php"; spl_autoload_register(function($class) { - list ($namespace, $class_name) = explode('\\', $class, 2); + $namespace = ''; + $class_name = $class; + + if (strpos($class, '\\') !== FALSE) + list ($namespace, $class_name) = explode('\\', $class, 2); $root_dir = dirname(__DIR__); // we're in tt-rss/include