From f5a5e39f0b7f68b632f129034f6891cc149c5ef0 Mon Sep 17 00:00:00 2001
From: Chris Andrews <triforce@users.noreply.github.com>
Date: Wed, 18 Jan 2017 20:31:47 +0000
Subject: [PATCH] Fix memory leak in getDirectoriesFoundInManifest() (#11205)

* Fixes #11197

The 'while' loop was causing a memory leak, replaced with an 'if' to match the correct functionality.

* Removed blank lines.

* Add back while loop and added an extra condition to prevent infinite loop.
---
 core/FileIntegrity.php | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/core/FileIntegrity.php b/core/FileIntegrity.php
index 6bc479e8f5..8e91730d61 100644
--- a/core/FileIntegrity.php
+++ b/core/FileIntegrity.php
@@ -255,13 +255,12 @@ class FileIntegrity
             $directory = $file;
 
             // add this directory and each parent directory
-            while( ($directory = dirname($directory)) && $directory != '.' ) {
+            while( ($directory = dirname($directory)) && $directory != '.' && $directory != '/') {
                 $directories[] = $directory;
             }
         }
         $directories = array_unique($directories);
         return $directories;
-
     }
 
     protected static function getPluginsFoundInManifest()
@@ -465,4 +464,4 @@ class FileIntegrity
         return null;
     }
 
-}
\ No newline at end of file
+}
-- 
GitLab