From 9707a3cfb93e939b0c65965384e60d5083fad213 Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Tue, 4 Jun 2024 16:51:05 +0200 Subject: [PATCH] Add check for empty array before accessing elements. - Added a condition to check for an empty array before accessing its elements in the getArrayValue function. This prevents potential errors when trying to access values from an empty array. --- index.php | 1 + 1 file changed, 1 insertion(+) diff --git a/index.php b/index.php index 7d8da52..9c0eeb5 100644 --- a/index.php +++ b/index.php @@ -108,6 +108,7 @@ function getArrayValue($elem, $array) { $elem = explode('.', $elem); $new_array = $array; foreach ($elem as $i) { + if(empty($new_array)) break; $new_array = $new_array[$i]; } return $new_array;