Browse Source

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

Andrew Dolgov 6 năm trước cách đây
mục cha
commit
a2d1fa5b14
1 tập tin đã thay đổi với 5 bổ sung1 xóa
  1. 5 1
      include/autoload.php

+ 5 - 1
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