From 67e77560a6b4a09358b0665fd1a264025bb6b80b Mon Sep 17 00:00:00 2001 From: fusionate Date: Sun, 21 May 2023 01:13:45 +0000 Subject: [PATCH] Database [Class]: Updates for PHP 8.1 --- resources/classes/database.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/resources/classes/database.php b/resources/classes/database.php index 97e941ef4b..9bd832be27 100644 --- a/resources/classes/database.php +++ b/resources/classes/database.php @@ -1870,10 +1870,10 @@ $m = 0; //loop through the array - if (is_array($array)) { + if (!empty($array) && is_array($array)) { $x = 0; foreach ($array as $parent_name => $tables) { - if (is_array($tables)) { + if (!empty($tables) && is_array($tables)) { foreach ($tables as $id => $row) { //prepare the variables @@ -1881,7 +1881,7 @@ $parent_key_name = self::singular($parent_name)."_uuid"; //build the toggle array - if ($row['checked'] == 'true') { + if (!empty($row['checked']) && $row['checked'] == 'true') { //toggle the field value //$toggle_array[$parent_name][$x][$parent_key_name] = $row[$parent_key_name]; $toggle_array[$parent_name][$x] = $row; @@ -1895,7 +1895,7 @@ //find the child tables $y = 0; - if (is_array($field_value)) { + if (!empty($field_value) && is_array($field_value)) { //prepare the variables $child_name = self::sanitize($field_name); $child_key_name = self::singular($child_name)."_uuid"; @@ -1930,14 +1930,14 @@ unset($array); //get the $apps array from the installed apps from the core and mod directories - if (!is_array($_SESSION['apps'])) { + if (empty($_SESSION['apps']) || !is_array($_SESSION['apps'])) { self::get_apps(); } //search through all fields to see if toggle field exists if (is_array($_SESSION['apps'])) { foreach ($_SESSION['apps'] as $x => $app) { - if (is_array($app['db'])) { + if (!empty($app['db']) && is_array($app['db'])) { foreach ($app['db'] as $y => $row) { if (is_array($row['table']['name'])) { $table_name = $row['table']['name']['text'];