From 42dda57f964f3e5936cfda941aecd21c51c99d7d Mon Sep 17 00:00:00 2001
From: Angie Byron <webchick@24967.no-reply.drupal.org>
Date: Sat, 27 Sep 2008 20:03:35 +0000
Subject: [PATCH] #312677 by CorniI: Check to ensure a file exists when fixing
 installation file.

---
 includes/install.inc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/includes/install.inc b/includes/install.inc
index 047701480b31..9ff123267160 100644
--- a/includes/install.inc
+++ b/includes/install.inc
@@ -733,6 +733,11 @@ function drupal_install_mkdir($file, $mask, $message = TRUE) {
  *  TRUE/FALSE whether or not we were able to fix the file's permissions.
  */
 function drupal_install_fix_file($file, $mask, $message = TRUE) {
+  // If $file does not exist, fileperms() issues a PHP warning.
+  if (!file_exists($file)) {
+    return FALSE;
+  }
+
   $mod = fileperms($file) & 0777;
   $masks = array(FILE_READABLE, FILE_WRITABLE, FILE_EXECUTABLE, FILE_NOT_READABLE, FILE_NOT_WRITABLE, FILE_NOT_EXECUTABLE);
 
-- 
GitLab