autoloader: check if class name is namespaced before trying to split it

This commit is contained in:
Andrew Dolgov 2018-07-18 13:25:18 +03:00
parent 331ded21ba
commit a2d1fa5b14

View file

@ -2,6 +2,10 @@
require_once "functions.php"; require_once "functions.php";
spl_autoload_register(function($class) { spl_autoload_register(function($class) {
$namespace = '';
$class_name = $class;
if (strpos($class, '\\') !== FALSE)
list ($namespace, $class_name) = explode('\\', $class, 2); list ($namespace, $class_name) = explode('\\', $class, 2);
$root_dir = dirname(__DIR__); // we're in tt-rss/include $root_dir = dirname(__DIR__); // we're in tt-rss/include