MDL-50153 core: Use directory_separator when autoloading psr0 classes

This commit is contained in:
Andrew Nicols
2015-05-08 12:17:20 +08:00
parent b3ec0280ea
commit c1108ed7fc
+3 -3
View File
@@ -706,12 +706,12 @@ $cache = '.var_export($cache, true).';
*/
protected static function load_psr_classes($basedir, $subdir = null) {
if ($subdir) {
$fulldir = implode(DIRECTORY_SEPARATOR, array($basedir, $subdir));
$classnameprefix = preg_replace('/\//', '_', $subdir);
$fulldir = realpath($basedir . DIRECTORY_SEPARATOR . $subdir);
$classnameprefix = preg_replace('#' . preg_quote(DIRECTORY_SEPARATOR) . '#', '_', $subdir);
} else {
$fulldir = $basedir;
}
if (!is_dir($fulldir)) {
if (!$fulldir || !is_dir($fulldir)) {
return;
}