Explorar el Código

Database [Class]: Updates for PHP 8.1

fusionate hace 2 años
padre
commit
125cd54af5
Se han modificado 1 ficheros con 6 adiciones y 6 borrados
  1. 6 6
      resources/classes/database.php

+ 6 - 6
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'];