From 7a7165ee0d4802bb82ff70275230070bc8920a52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20S=C3=A9verin?= Date: Tue, 18 Dec 2018 13:59:24 +0000 Subject: [PATCH] Allow running PHPUnit with "xdebug.scream" ON Since https://github.com/symfony/symfony/pull/25733 the Kernel attempts to unlink the legacy container while being built. This throws an error if the file did not exist, for example on a clean install, on the build, which is then silenced. That's fine on production systems, but on our build we have enabled "xdebug.scream" in order to visualise every errors, which basically un-silences the errors. I believe there should not be a need to silence anything on a usual, clean usage of the system. Making this `unlink` conditional fixes it. Could you please approve and merge this PR? Thanks --- src/Symfony/Component/HttpKernel/Kernel.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 8635c2dfc4..3d28967ed0 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -862,7 +862,10 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl $fs->dumpFile($dir.$file, $code); @chmod($dir.$file, 0666 & ~umask()); } - @unlink(\dirname($dir.$file).'.legacy'); + $legacyFile = \dirname($dir.$file).'.legacy'; + if (file_exists($legacyFile)) { + @unlink($legacyFile); + } $cache->write($rootCode, $container->getResources()); }