Browse Source

If there is no namespace in classname the 1st character was stripped off

Miha Vrhovnik 14 years ago
parent
commit
cd7ab69a17
1 changed files with 5 additions and 1 deletions
  1. 5 1
      src/Symfony/Component/Validator/Mapping/ClassMetadata.php

+ 5 - 1
src/Symfony/Component/Validator/Mapping/ClassMetadata.php

@@ -41,7 +41,11 @@ class ClassMetadata extends ElementMetadata
     {
         $this->name = $class;
         // class name without namespace
-        $this->defaultGroup = substr($class, strrpos($class, '\\') + 1);
+        if (false !== $nsSep = strrpos($class, '\\')) {
+            $this->defaultGroup = substr($class, $nsSep + 1);
+        } else {
+            $this->defaultGroup = $class;
+        }
     }
 
     /**