common icon indicating copy to clipboard operation
common copied to clipboard

Proxy Autoloader: autoloader assumes $notFoundCallback always creates the proxy file

Open alcaeus opened this issue 6 years ago • 0 comments

I saw this while trying to figure out https://github.com/doctrine/DoctrineBundle/issues/848. In this case, the autoloader was called to load a proxy for a mapped superclass. Since the file didn't exist, the $notFoundCallback was called to generate a proxy class. However, the ProxyFactory in ORM will skip over mapped superclasses and didn't create a class, but neither threw an exception.

This causes an error because the autoloader wrongly assumes that the file will be present, at least after invoking the $notFoundCallback: https://github.com/doctrine/common/blob/master/lib/Doctrine/Common/Proxy/Autoloader.php#L74. However, this assumption is wrong and should probably be checked, with an exception being thrown if no file was generated/found.

alcaeus avatar Apr 11 '19 08:04 alcaeus