From a2c54d98b425f45f47092111724ef655f3754fcf Mon Sep 17 00:00:00 2001 From: frytimo Date: Sat, 20 Jan 2024 19:45:23 -0400 Subject: [PATCH] ensure $git_repo is an array and has elements before access (#6874) --- resources/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/functions.php b/resources/functions.php index 38d09bbf78..f9ffb2b21f 100644 --- a/resources/functions.php +++ b/resources/functions.php @@ -2333,7 +2333,7 @@ if (!function_exists('is_git_repo')) { chdir($path); exec("git rev-parse --show-toplevel", $git_repo, $git_repo_response); chdir($cwd); - if (($git_repo[0]) != $cwd && $git_repo_response == 0) { + if ((is_array($git_repo) && count($git_repo) > 0) && ($git_repo[0] != $cwd) && $git_repo_response == 0) { return $git_repo[0]; } return false;