Bug workaround for (undocumented?) autoload change in PHP 5.3.?
authorDaniel Rudolf <rudolf@eifel-online.com>
Sat, 9 Feb 2013 01:03:07 +0000 (02:03 +0100)
committerDaniel Rudolf <rudolf@eifel-online.com>
Sat, 9 Feb 2013 01:03:07 +0000 (02:03 +0100)
Our local vanilla 5.3.8 always receives classes for autoloading fully-qualified without leading slash (as written in the PHP doc), but a customers 5.3.2-1ubuntu4.18 sometimes receives it with an leading slash. Simple way of handling that, breaks nothing and normally won't affect anything.

wcfsetup/install/files/lib/system/WCF.class.php

index 01fa9fcbe3be3131c5742a845076cf7af8ee2de8..eba5af5ef1614b92197f668c0aed31b18f8b778a 100644 (file)
@@ -534,6 +534,8 @@ class WCF {
                $namespaces = explode('\\', $className);
                if (count($namespaces) > 1) {
                        $applicationPrefix = array_shift($namespaces);
+                       if($applicationPrefix === '')
+                               $applicationPrefix = array_shift($namespaces);
                        if (isset(self::$autoloadDirectories[$applicationPrefix])) {
                                $classPath = self::$autoloadDirectories[$applicationPrefix] . implode('/', $namespaces) . '.class.php';
                                if (file_exists($classPath)) {