BUGFIX: Allow classes to be referred to with casing that differs from their definition. (from r101131)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@111958 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2010-10-12 21:41:13 +00:00
parent ab46f9d2b1
commit 3650b571fc
2 changed files with 7 additions and 4 deletions

View File

@ -293,7 +293,9 @@ function getTempFolder($base = null) {
*/
function __autoload($className) {
global $_CLASS_MANIFEST;
if(isset($_CLASS_MANIFEST[$className])) include_once($_CLASS_MANIFEST[$className]);
$lClassName = strtolower($className);
if(isset($_CLASS_MANIFEST[$lClassName])) include_once($_CLASS_MANIFEST[$lClassName]);
else if(isset($_CLASS_MANIFEST[$className])) include_once($_CLASS_MANIFEST[$className]);
}
/**
@ -301,8 +303,9 @@ function __autoload($className) {
*/
function getClassFile($className) {
global $_CLASS_MANIFEST;
if(($pos = strpos($className,'_')) !== false) $className = substr($className,0,$pos);
if($_CLASS_MANIFEST[$className]) return $_CLASS_MANIFEST[$className];
$lClassName = strtolower($className);
if(isset($_CLASS_MANIFEST[$lClassName])) return $_CLASS_MANIFEST[$lClassName];
else if(isset($_CLASS_MANIFEST[$className])) return $_CLASS_MANIFEST[$className];
}
/**

View File

@ -381,7 +381,7 @@ class ManifestBuilder {
foreach(self::$classArray as $class => $info) {
$allClasses['exists'][$class] = $class;
$allClasses['file'][$class] = $info['file'];
$allClasses['file'][strtolower($class)] = $info['file'];
}
// Build a map of classes and their subclasses