diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CompilerDebugDumpPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CompilerDebugDumpPass.php index 28ad7082fa..f152ce8c50 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CompilerDebugDumpPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CompilerDebugDumpPass.php @@ -14,6 +14,7 @@ namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\Filesystem\Exception\IOException; use Symfony\Component\Filesystem\Filesystem; class CompilerDebugDumpPass implements CompilerPassInterface @@ -24,8 +25,11 @@ class CompilerDebugDumpPass implements CompilerPassInterface $filesystem = new Filesystem(); $filesystem->dumpFile($filename, implode("\n", $container->getCompiler()->getLog()), null); - // discard chmod failure (some filesystem may not support it) - @chmod($filename, 0666 & ~umask()); + try { + $filesystem->chmod($filename, 0666, umask()); + } catch (IOException $e) { + // discard chmod failure (some filesystem may not support it) + } } public static function getCompilerLogFilename(ContainerInterface $container) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/ContainerBuilderDebugDumpPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/ContainerBuilderDebugDumpPass.php index 6cf52b6522..467ecff283 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/ContainerBuilderDebugDumpPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/ContainerBuilderDebugDumpPass.php @@ -14,6 +14,7 @@ namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Dumper\XmlDumper; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\Filesystem\Exception\IOException; use Symfony\Component\Filesystem\Filesystem; /** @@ -31,7 +32,10 @@ class ContainerBuilderDebugDumpPass implements CompilerPassInterface $filename = $container->getParameter('debug.container.dump'); $filesystem = new Filesystem(); $filesystem->dumpFile($filename, $dumper->dump(), null); - // discard chmod failure (some filesystem may not support it) - @chmod($filename, 0666 & ~umask()); + try { + $filesystem->chmod($filename, 0666, umask()); + } catch (IOException $e) { + // discard chmod failure (some filesystem may not support it) + } } } diff --git a/src/Symfony/Component/Config/ConfigCache.php b/src/Symfony/Component/Config/ConfigCache.php index 73de9c2e5f..868a0572eb 100644 --- a/src/Symfony/Component/Config/ConfigCache.php +++ b/src/Symfony/Component/Config/ConfigCache.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Config; use Symfony\Component\Config\Resource\ResourceInterface; +use Symfony\Component\Filesystem\Exception\IOException; use Symfony\Component\Filesystem\Filesystem; /** @@ -93,14 +94,23 @@ class ConfigCache */ public function write($content, array $metadata = null) { - $mode = 0666 & ~umask(); + $mode = 0666; + $umask = umask(); $filesystem = new Filesystem(); $filesystem->dumpFile($this->file, $content, null); - @chmod($this->file, $mode); + try { + $filesystem->chmod($this->file, $mode, $umask); + } catch (IOException $e) { + // discard chmod failure (some filesystem may not support it) + } if (null !== $metadata && true === $this->debug) { $filesystem->dumpFile($this->getMetaFile(), serialize($metadata), null); - @chmod($this->getMetaFile(), $mode); + try { + $filesystem->chmod($this->getMetaFile(), $mode, $umask); + } catch (IOException $e) { + // discard chmod failure (some filesystem may not support it) + } } }