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:
parent
dcf62d3865
commit
9707a3cfb9
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user