Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-183

Annotation parser barfs on "@something at."

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0-ALPHA4
    • Component/s: ORM
    • Security Level: All
    • Labels:
      None

      Description

      Here's an odd one: The annotations parser has some quirk where it barfs if the comment contains a line that starts with any tag and ends with "at.":

      /**
       * @Entity
       * @test at.
       */
      class A
      {
      }
      
      $a = new A;
      $em->persist($a);
      

      The result is:

      PHP Fatal error:  Uncaught exception 'Doctrine\Common\Annotations\AnnotationException'
          with message '[Syntax Error] Expected Doctrine\Common\Annotations\Lexer::T_IDENTIFIER, got '.' at position 19 in class A.'
          in Doctrine\Common\Annotations\AnnotationException.php:39
      Stack trace:
      #0  Doctrine\Common\Annotations\Parser.php(182): Doctrine\Common\Annotations\AnnotationException::syntaxError('Expected Doctri...')
      #1  Doctrine\Common\Annotations\Parser.php(150): Doctrine\Common\Annotations\Parser->syntaxError('Doctrine\Common...')
      #2  Doctrine\Common\Annotations\Parser.php(229): Doctrine\Common\Annotations\Parser->match(2)
      #3  Doctrine\Common\Annotations\Parser.php(204): Doctrine\Common\Annotations\Parser->Annotation()
      #4  Doctrine\Common\Annotations\Parser.php(134): Doctrine\Common\Annotations\Parser->Annotations()
      #5  Doctrine\Common\Annotations\AnnotationReader.php(102): Doctrine\Common\Annotations\Parser->parse('/**? * @Entity?...', 'class A')
      #6  Doctrine\ORM\Mapping\Driver\AnnotationDriver.php(73): Doctrine\Common\Annotations\AnnotationReader->getClassAnnotations(Object(ReflectionClass))
      #7  Doctrine\ORM\Mapping\ClassMetadataFactory.php(196): Doctrine\ORM\Mapping\Driver\AnnotationDriver->loadMetadataForClass('A', Object(Doctrine\ORM\Mapping\ClassMetadata))
      #8  Doctrine\ORM\Mapping\ClassMetadataFactory.php(111): Doctrine\ORM\Mapping\ClassMetadataFactory->_loadMetadata('A')
      #9  Doctrine\ORM\EntityManager.php(214): Doctrine\ORM\Mapping\ClassMetadataFactory->getMetadataFor('A')
      #10 Doctrine\ORM\UnitOfWork.php(1182): Doctrine\ORM\EntityManager->getClassMetadata('A')
      #11 Doctrine\ORM\UnitOfWork.php(1160): Doctrine\ORM\UnitOfWork->_doPersist(Object(A), Array)
      #12 Doctrine\ORM\EntityManager.php(393): Doctrine\ORM\UnitOfWork->persist(Object(A))
      #13 test.php(40): Doctrine\ORM\EntityManager->persist(Object(A))
      #14 {main}
      

        Activity

        Hide
        ivo nascimento added a comment -

        i, I'm attempting to fix this one myself. Patch will be uploaded when ready.

        Show
        ivo nascimento added a comment - i, I'm attempting to fix this one myself. Patch will be uploaded when ready.
        Hide
        Guilherme Blanco added a comment -

        In r6974 this issue was fixed.

        Show
        Guilherme Blanco added a comment - In r6974 this issue was fixed.

          People

          • Assignee:
            Guilherme Blanco
            Reporter:
            Amir Abiri
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: