[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 Fri Oct 09 06:46:18 EDT 2015 using JIRA 6.4.10#64025-sha1:5b8b74079161cd76a20ab66dda52747ee6701bd6.