Doctrine PHPCR
  1. Doctrine PHPCR
  2. PHPCR-22

find('\Foo\Bar', $path) vs find('Foo\Bar', $path)

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Labels:
      None

      Description

      I just noticed that we have an issue in our metadata loading in case a document name is prefixed with a backslash when calling find

      // fails
      $dm->find('\Foo\Bar', $path);

      // works
      $dm->find('Foo\Bar', $path);

      Should the first work as well?

      I have traced the issue to the DriverChain

      public function loadMetadataForClass($className, ClassMetadata $class)
      {
      foreach ($this->drivers as $namespace => $driver) {
      if (strpos($className, $namespace) === 0)

      { $driver->loadMetadataForClass($className, $class); return; }

      }

      throw MappingException::classIsNotAValidDocument($className);
      }

      notice the strpos() does not bother to check if a preceding backslash is in the $className var.

        Activity

        Hide
        Lukas Kahwe added a comment -

        the ORM doesn't handle this either

        Show
        Lukas Kahwe added a comment - the ORM doesn't handle this either

          People

          • Assignee:
            Jordi Boggiano
            Reporter:
            Lukas Kahwe
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: