[Foundation] added a check to the Universal class loader

This commit is contained in:
Fabien Potencier 2010-02-17 10:11:02 +01:00
parent 5cdee87b14
commit 67964d0daa
1 changed files with 10 additions and 2 deletions

View File

@ -124,7 +124,11 @@ class UniversalClassLoader
if (0 === strpos($namespace, $ns))
{
$class = substr($class, $pos + 1);
require $dir.DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $namespace).DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $class).'.php';
$file = $dir.DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $namespace).DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $class).'.php';
if (file_exists($file))
{
require $file;
}
return;
}
@ -137,7 +141,11 @@ class UniversalClassLoader
{
if (0 === strpos($class, $prefix))
{
require $dir.DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $class).'.php';
$file = $dir.DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $class).'.php';
if (file_exists($file))
{
require $file;
}
return;
}