Skip to content

Commit

Permalink
[Debug] fix wrong case mismatch exception
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Jun 2, 2014
1 parent 9c60a85 commit 8e9cc35
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Symfony/Component/Debug/DebugClassLoader.php
Expand Up @@ -175,7 +175,7 @@ public function loadClass($class)
$refl = new \ReflectionClass($class);
$name = $refl->getName();

if ($name !== $class) {
if ($name !== $class && 0 === strcasecmp($name, $class)) {
throw new \RuntimeException(sprintf('Case mismatch between loaded and declared class names: %s vs %s', $class, $name));
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php
Expand Up @@ -151,6 +151,11 @@ public function testNotPsr0Bis()
{
$this->assertTrue(class_exists(__NAMESPACE__.'\Fixtures\NotPSR0bis', true));
}

public function testClassAlias()
{
$this->assertTrue(class_exists(__NAMESPACE__.'\Fixtures\ClassAlias', true));
}
}

class ClassLoader
Expand Down
3 changes: 3 additions & 0 deletions src/Symfony/Component/Debug/Tests/Fixtures/ClassAlias.php
@@ -0,0 +1,3 @@
<?php

class_alias('Symfony\Component\Debug\Tests\Fixtures\NotPSR0bis', 'Symfony\Component\Debug\Tests\Fixtures\ClassAlias');

0 comments on commit 8e9cc35

Please sign in to comment.