[DCOM-47] When using different class loaders Created: 07/Apr/11  Updated: 27/Dec/11  Resolved: 14/Sep/11

Status: Resolved
Project: Doctrine Common
Component/s: Class Loading
Affects Version/s: 2.1
Fix Version/s: 2.1.2

Type: Bug Priority: Major
Reporter: Gediminas Morkevicius Assignee: Guilherme Blanco
Resolution: Cannot Reproduce Votes: 0
Labels: None
Environment:

all



 Description   

ClassLoader::classExists($class); will fail if different class loader is used which does not return any boolean value. This includes Symfony2 UniversalClassLoader

I have never used this function before because native PHP method class_exits($class, true) first will try to autoload. But if the class does not exist
and you are using Doctrine\Common::ClassLoader and you call class_exists($class) it will trigger fatal error. This behavior makes it impossible to make code compatible
with different class loading mechanisms for Doctrine2



 Comments   
Comment by Christophe Coevoet [ 07/Apr/11 ]

This is known and documented in the code: https://github.com/doctrine/common/blob/master/lib/Doctrine/Common/Annotations/Parser.php#L110

Comment by Guilherme Blanco [ 14/Sep/11 ]

Since Annotations package changed a lot since the bug was opened and today, I'm closing the ticket as "Cannot reproduce".

Please reopen it if the issue is still valid with a testcase.

Cheers,

Comment by Benjamin Eberlei [ 27/Dec/11 ]

This issue is referenced in Github Pull-Request GH-88
https://github.com/doctrine/common/pull/88

Comment by Jan Dolecek [ 27/Dec/11 ]

Still a problem! Especially since this is used by ORM (https://github.com/doctrine/doctrine2/commit/3aea203b9ca77df65f55f036080a9af653194cbf)

Class loader doesn't have to return bool (and usually DOES NOT), so even though it has loaded the class, classExists will return false. Please pull this https://github.com/doctrine/common/pull/88

Comment by Benjamin Eberlei [ 27/Dec/11 ]

Related Pull Request was closed: https://github.com/doctrine/common/pull/88

Generated at Tue Sep 16 21:39:13 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.