DDC-96: Problem using Doctrine Autoloaders from Global Namespace #120

Closed
opened 2026-01-22 12:27:51 +01:00 by admin · 4 comments
Owner

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

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user @beberlei:

The Doctrine Autoloaders don't work from the global namespace in the following context:

Loader::loadClass("\Doctrine\ORM\Mapping\Driver\AnnotationsDriver");

The prefix slash is not matched and the doctrine autoloader fails.

Originally created by @doctrinebot on GitHub (Nov 2, 2009). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user @beberlei: The Doctrine Autoloaders don't work from the global namespace in the following context: ``` Loader::loadClass("\Doctrine\ORM\Mapping\Driver\AnnotationsDriver"); ``` The prefix slash is not matched and the doctrine autoloader fails.
admin added the Bug label 2026-01-22 12:27:51 +01:00
admin closed this issue 2026-01-22 12:27:51 +01:00
Author
Owner

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

Comment created by @beberlei:

The problem is rather that i want to address a class by its fully qualified name:

$class = '\Doctrine\ORM\Mapping\Driver\AnnnotationDriver';

if(class_exists($class)) {

} else {
    // he cant find it with the \ prefixed
}

The IsolatedClassLoader tries to match the namespace against the class:

string(9) "Doctrine\"
string(46) "\Doctrine\ORM\Mapping\Driver\AnnnotationDriver"

And the strpos prefix check fails on this.

@doctrinebot commented on GitHub (Nov 2, 2009): Comment created by @beberlei: The problem is rather that i want to address a class by its fully qualified name: ``` $class = '\Doctrine\ORM\Mapping\Driver\AnnnotationDriver'; if(class_exists($class)) { } else { // he cant find it with the \ prefixed } ``` The IsolatedClassLoader tries to match the namespace against the class: ``` string(9) "Doctrine\" string(46) "\Doctrine\ORM\Mapping\Driver\AnnnotationDriver" ``` And the strpos prefix check fails on this.
Author
Owner

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

Comment created by romanb:

Namespaces in strings are always fully qualified so there is no need for the leading backslash.

@doctrinebot commented on GitHub (Nov 2, 2009): Comment created by romanb: Namespaces in strings are **always** fully qualified so there is no need for the leading backslash.
Author
Owner

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

Comment created by @beberlei:

This was just a typo in the class name, sorry :)

@doctrinebot commented on GitHub (Nov 2, 2009): Comment created by @beberlei: This was just a typo in the class name, sorry :)
Author
Owner

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

Issue was closed with resolution "Invalid"

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

No dependencies set.

Reference: doctrine/archived-orm#120