From a4dc076dc8fd997c054325ed21bab30e30f68fbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=96=D0=B0=D0=BA=D0=BE=D0=B2=20=D0=92=D0=B8=D1=82=D0=B0?= =?UTF-8?q?=D0=BB=D0=B8=D0=B9?= Date: Wed, 15 Jan 2020 18:09:42 +0500 Subject: [PATCH] fix file load errors --- src/Composer/Autoload/AutoloadGenerator.php | 4 ++-- src/Composer/Json/JsonFile.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index bb0c94c49..6ca4b3329 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -318,7 +318,7 @@ EOF; private function filePutContentsIfModified($path, $content) { - $currentContent = file_get_contents($path); + $currentContent = @file_get_contents($path); if (!$currentContent || ($currentContent != $content)) { return file_put_contents($path, $content); } @@ -1014,7 +1014,7 @@ INITIALIZER; */ protected function safeCopy($source, $target) { - if (!$this->filesAreEqual($source, $target)) { + if (!file_exists($target) OR !file_exists($source) OR !$this->filesAreEqual($source, $target)) { $source = fopen($source, 'r'); $target = fopen($target, 'w+'); diff --git a/src/Composer/Json/JsonFile.php b/src/Composer/Json/JsonFile.php index 3b9b74082..89524df39 100644 --- a/src/Composer/Json/JsonFile.php +++ b/src/Composer/Json/JsonFile.php @@ -147,7 +147,7 @@ class JsonFile */ private function filePutContentsIfModified($path, $content) { - $currentContent = file_get_contents($path); + $currentContent = @file_get_contents($path); if (!$currentContent || ($currentContent != $content)) { return file_put_contents($path, $content); }