DDC-1104: Require statement in AnnotationDriver.php can cause PHP Fatal error #1381

Open
opened 2026-01-22 13:12:38 +01:00 by admin · 0 comments
Owner

Originally created by @doctrinebot on GitHub (Apr 6, 2011).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user majkl578:

The require statement in Doctrine/ORM/Mapping/Driver/AnnotationDriver.php causes troubles in some cases. Imagine the situation when you're creating your own class loader which maps all classes and loads all requested classes lazily. When it loads any class from DoctrineAnnotations.php before loading AnnotationDriver and this class is loaded later, you get: PHP Fatal error: Cannot redeclare class ....

Changing require to require_once solves the problem.

Pull request: https://github.com/doctrine/doctrine2/pull/45

Originally created by @doctrinebot on GitHub (Apr 6, 2011). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user majkl578: The _require_ statement in `Doctrine/ORM/Mapping/Driver/AnnotationDriver.php` causes troubles in some cases. Imagine the situation when you're creating your own class loader which maps all classes and loads all requested classes lazily. When it loads any class from DoctrineAnnotations.php **before** loading AnnotationDriver and this class is loaded later, you get: `PHP Fatal error: Cannot redeclare class ...`. Changing _require_ to _require_once_ solves the problem. Pull request: https://github.com/doctrine/doctrine2/pull/45
admin added the Bug label 2026-01-22 13:12:38 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#1381