[DDC-2064] [GH-469] ProxyFactory: Catch exception if type hint of entity method parameter is invalid Created: 11/Oct/12  Updated: 29/Dec/13  Resolved: 06/Jan/13

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Invalid Votes: 0
Labels: None

Doctrine 2.2.2, Symfony 2.0.17


In Symfony I got this exception when I access the page after cleaning the cache:

PHP Fatal error:  Uncaught exception 'ReflectionException' with message 'Class integer does not exist' in C:\projects\osl\trunk\vendor\doctrine\lib\Doctrine\ORM\Proxy\ProxyFactory.php:226
Stack trace:
#0 C:\projects\osl\trunk\vendor\doctrine\lib\Doctrine\ORM\Proxy\ProxyFactory.php(226): ReflectionParameter->getClass()
#1 C:\projects\osl\trunk\vendor\doctrine\lib\Doctrine\ORM\Proxy\ProxyFactory.php(160): Doctrine\ORM\Proxy\ProxyFactory->_generateMethods(Object(Doctrine\ORM\Mapping\ClassMetadata))
#2 C:\projects\osl\trunk\vendor\doctrine\lib\Doctrine\ORM\Proxy\ProxyFactory.php(144): Doctrine\ORM\Proxy\ProxyFactory->_generateProxyClass(Object(Doctrine\ORM\Mapping\ClassMetadata), 'C:/projects/osl...', '<?php??namespac...')
#3 C:\projects\osl\trunk\vendor\symfony\src\Symfony\Bridge\Doctrine\CacheWarmer\ProxyCacheWarmer.php(68): Doctrine\ORM\Proxy\ProxyFactory->generateProxyClasses(Array)
#4 C:\projects\osl\trunk\vendor\symfony\src\Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate.php(47): Symfony\Bridge\Doctrine\CacheWa in C:\projects\osl\trunk\vendor\doctrine\lib\Doctrine\ORM\Proxy\ProxyFactory.php on line 226

The reason was a wrong type hint in the setter method of a property:

    public function setAdrid(\integer $adrid)
        $this->adrid = $adrid;
        return $this;

Is it possible to merge this fix also into 2.2 branch? Or should I do that myself?

I made a pull request on github


ProxyFactory: Catch exception if a type hint of an entity's method parameter is invalid and forward the exception with a better readable and more helpful message.

Comment by Benjamin Eberlei [ 06/Jan/13 ]

Problem will be fixed in refactoring that Marco Pivetta is currently doing.

Comment by Doctrine Bot [ 29/Dec/13 ]

A related Github Pull-Request [GH-469] was closed:

Generated at Mon Jul 28 10:35:58 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.