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.
This commit is contained in:
Jeroen De Meerleer 2024-06-04 16:51:05 +02:00
parent dcf62d3865
commit 9707a3cfb9
Signed by: JeroenED
GPG Key ID: 28CCCB8F62BFADD6

View File

@ -108,6 +108,7 @@ function getArrayValue($elem, $array) {
$elem = explode('.', $elem); $elem = explode('.', $elem);
$new_array = $array; $new_array = $array;
foreach ($elem as $i) { foreach ($elem as $i) {
if(empty($new_array)) break;
$new_array = $new_array[$i]; $new_array = $new_array[$i];
} }
return $new_array; return $new_array;