From d12228d2e8afceea6d54880ae6fec80e1cc8399b Mon Sep 17 00:00:00 2001 From: stickz Date: Mon, 10 Jan 2022 01:27:00 -0500 Subject: [PATCH] Fix loading utility classes --- php/util.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/php/util.php b/php/util.php index 2c4d9f88a..90948b475 100644 --- a/php/util.php +++ b/php/util.php @@ -5,8 +5,15 @@ require_once( $rootPath.'/conf/config.php' ); // Automatically include only the used utility classes -spl_autoload_register(function ($class) { - require_once 'utility/'. strtolower($class). '.php'; +spl_autoload_register(function ($class) +{ + // Remove namespaces from the classname string + // Important for compatibility with 3rd party plugins + if (preg_match('@\\\\([\w]+)$@', $class, $matches)) { + $class = $matches[1]; + } + + require_once 'utility/'. strtolower($class). '.php'; }); // Fixes quotations if php verison is less than 5.4