From 51df5547cb9c6cff742bf5bd009565281197f47d Mon Sep 17 00:00:00 2001 From: Stefan Brand Date: Fri, 18 Feb 2022 13:08:16 +0100 Subject: [PATCH] Catch Undefined Variables in Directory Scan --- index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.php b/index.php index fb5073a..4c0a3d1 100644 --- a/index.php +++ b/index.php @@ -74,8 +74,8 @@ if (isset($_SESSION[$cdir]) $files = array_diff(scandir($imagedir.$dir, SCANDIR_SORT_DESCENDING), $rmdirs); // Filter Unsupported Files $files = array_values(preg_grep('/.*\.(?!(webm|sh)).*/i', $files)); - $_SESSION[$cdir]['f'] = $files; - $_SESSION[$cdir]['d'] = $dirs; + $_SESSION[$cdir]['f'] = isset($files) ? $files : null; + $_SESSION[$cdir]['d'] = isset($dirs) ? $dirs : null; $_SESSION[$cdir]['t'] = time(); }