From e6c16aa7e5a7ed1d0bb3f9dd810e57505fa74c31 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 15 Feb 2024 12:23:44 +0100 Subject: [dnbd3] Fix type error Uncaught TypeError: Dnbd3Util::runmodeConfigHook(): Argument #3 ($modeData) must be of type string, null given --- modules-available/dnbd3/inc/dnbd3util.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'modules-available/dnbd3') diff --git a/modules-available/dnbd3/inc/dnbd3util.inc.php b/modules-available/dnbd3/inc/dnbd3util.inc.php index 7d95147a..314c44fe 100644 --- a/modules-available/dnbd3/inc/dnbd3util.inc.php +++ b/modules-available/dnbd3/inc/dnbd3util.inc.php @@ -110,7 +110,7 @@ class Dnbd3Util { * * @param string $mode always 'proxy' */ - public static function runmodeConfigHook(string $machineUuid, string $mode, string $modeData) + public static function runmodeConfigHook(string $machineUuid, string $mode, ?string $modeData) { $self = Property::getServerIp(); // Get all directly assigned locations @@ -122,7 +122,7 @@ class Dnbd3Util { foreach ($res as $row) { $assignedLocs[] = $row['locationid']; } - $modeData = (array)json_decode($modeData, true) + self::defaultRunmodeConfig(); + $modeData = (array)json_decode($modeData ?? '{}', true) + self::defaultRunmodeConfig(); if (!empty($assignedLocs) && ($modeData['firewall'] ?? false)) { // Get all sub-locations too $recursiveLocs = $assignedLocs; -- cgit v1.2.3-55-g7522