Details
Description
Starting with Doctrine 2.2, the Proxy classes have inconsistent naming with their file name, which raises problems with class autoloading.
For example, a class named Application\Model\User creates the following proxy class:
Application\Proxy\__CG__\Application\Model\User
This class is located in the following file:
Application/Proxy/__CG__ApplicationModelUser.php
But whe we serialize such an entity, then unserialize it in another session, the framework autoloader expects the class to be located in:
Application/Proxy/__CG__/Application/Model/User.php
But it is not.
As a result, a __PHP_Incomplete_Class is created instead of the expected proxy class.
I'm not sure whether this is an intended behavior, but I would assume this is a bug.
It looks like there is an even broader problem with the new _CG_ prefix; the PSR-0 standard for autoloading states that the underscores should be handled this way:
\namespace\package\Class_Name => {...}/namespace/package/Class/Name.phpWhich means that in the above example, it could even expect the file to be located in:
... which is far away from the actual location.
Upgrade to 2.2 broke this code, for us.