From fbae6b1589ef28b77f0c38d1c9d4b964fb4d45bc Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 4 Aug 2015 10:34:54 +0200 Subject: [PATCH] Revert "Merge pull request #3975 from marc-mabe/hotfix/3974" This reverts commit bdb6ecb29e9624fb767aa690d09c780249050fc6, reversing changes made to 8a12e50a16dbc4ddf808b752ad64b412dba272d5. --- src/Composer/Autoload/ClassLoader.php | 8 ++++---- tests/Composer/Test/Autoload/ClassLoaderTest.php | 11 ----------- .../Composer/Test/Autoload/Fixtures/DirDotPhp/Dir.php | 6 ------ .../Autoload/Fixtures/DirDotPhp/psr4/Dir.php/File.php | 6 ------ 4 files changed, 4 insertions(+), 27 deletions(-) delete mode 100644 tests/Composer/Test/Autoload/Fixtures/DirDotPhp/Dir.php delete mode 100644 tests/Composer/Test/Autoload/Fixtures/DirDotPhp/psr4/Dir.php/File.php diff --git a/src/Composer/Autoload/ClassLoader.php b/src/Composer/Autoload/ClassLoader.php index 4e05d3b15..5e1469e83 100644 --- a/src/Composer/Autoload/ClassLoader.php +++ b/src/Composer/Autoload/ClassLoader.php @@ -351,7 +351,7 @@ class ClassLoader foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) { if (0 === strpos($class, $prefix)) { foreach ($this->prefixDirsPsr4[$prefix] as $dir) { - if (is_file($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { return $file; } } @@ -361,7 +361,7 @@ class ClassLoader // PSR-4 fallback dirs foreach ($this->fallbackDirsPsr4 as $dir) { - if (is_file($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { return $file; } } @@ -380,7 +380,7 @@ class ClassLoader foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { if (0 === strpos($class, $prefix)) { foreach ($dirs as $dir) { - if (is_file($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { return $file; } } @@ -390,7 +390,7 @@ class ClassLoader // PSR-0 fallback dirs foreach ($this->fallbackDirsPsr0 as $dir) { - if (is_file($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { return $file; } } diff --git a/tests/Composer/Test/Autoload/ClassLoaderTest.php b/tests/Composer/Test/Autoload/ClassLoaderTest.php index ec4156a15..50772101e 100644 --- a/tests/Composer/Test/Autoload/ClassLoaderTest.php +++ b/tests/Composer/Test/Autoload/ClassLoaderTest.php @@ -9,17 +9,6 @@ use Composer\Autoload\ClassLoader; */ class ClassLoaderTest extends \PHPUnit_Framework_TestCase { - public function testLoadClassDotPhp() - { - $loader = new ClassLoader(); - $loader->add('DirDotPhp\\', __DIR__ . '/Fixtures'); - $loader->addPsr4('DirDotPhp\\', __DIR__ . '/Fixtures/DirDotPhp/psr4'); - - $class = 'DirDotPhp\\Dir'; - $loader->loadClass($class); - $this->assertTrue(class_exists($class, false), "->loadClass() loads '$class'."); - } - /** * Tests regular PSR-0 and PSR-4 class loading. * diff --git a/tests/Composer/Test/Autoload/Fixtures/DirDotPhp/Dir.php b/tests/Composer/Test/Autoload/Fixtures/DirDotPhp/Dir.php deleted file mode 100644 index 9d9d62d8c..000000000 --- a/tests/Composer/Test/Autoload/Fixtures/DirDotPhp/Dir.php +++ /dev/null @@ -1,6 +0,0 @@ -