DDC-183: Annotation parser barfs on "@something at." #226

Closed
opened 2026-01-22 12:31:30 +01:00 by admin · 3 comments
Owner

Originally created by @doctrinebot on GitHub (Nov 30, 2009).

Originally assigned to: @guilhermeblanco on GitHub.

Jira issue originally created by user amirabiri:

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}
Originally created by @doctrinebot on GitHub (Nov 30, 2009). Originally assigned to: @guilhermeblanco on GitHub. Jira issue originally created by user amirabiri: 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} ```
admin added the Bug label 2026-01-22 12:31:30 +01:00
admin closed this issue 2026-01-22 12:31:32 +01:00
Author
Owner

@doctrinebot commented on GitHub (Nov 30, 2009):

Comment created by ivo.nascimento:

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

@doctrinebot commented on GitHub (Nov 30, 2009): Comment created by ivo.nascimento: i, I'm attempting to fix this one myself. Patch will be uploaded when ready.
Author
Owner

@doctrinebot commented on GitHub (Dec 22, 2009):

Comment created by @guilhermeblanco:

In r6974 this issue was fixed.

@doctrinebot commented on GitHub (Dec 22, 2009): Comment created by @guilhermeblanco: In r6974 this issue was fixed.
Author
Owner

@doctrinebot commented on GitHub (Dec 22, 2009):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Dec 22, 2009): Issue was closed with resolution "Fixed"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#226