Details
Description
When doing concurrent requests with autogeneration of proxies enabled, the proxy file does not exist when ProxyFactory tries to use it:
Doctrine/ORM/Proxy/ProxyFactory.php(92): spl_autoload_call('MyClassProxy'))
I think this is because file_put_contents is not atomic.
The following fixes it on Linux, but I think will not work in Windows (iirc, rename() on Windows won't work if the dest file already exists, much less atomically):
--- Proxy/ProxyFactory.php (revision 2) +++ Proxy/ProxyFactory.php (working copy) @@ -144,7 +144,9 @@ $file = str_replace($placeholders, $replacements, $file); - file_put_contents($fileName, $file); + $tmpFileName = $fileName.'-'.uniqid('', true);; + file_put_contents($tmpFileName, $file); + rename($tmpFileName, $fileName); } /**