diff --git a/wwwroot/inc/caching.php b/wwwroot/inc/caching.php index 4bd4fd7d2..cad455380 100644 --- a/wwwroot/inc/caching.php +++ b/wwwroot/inc/caching.php @@ -67,7 +67,7 @@ function HTTPDateToUnixTime ($string) $formats['asctime'] = '/^(Sun|Mon|Tue|Wed|Thu|Fri|Sat) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{2}| \d{1}) (\d{2}):(\d{2}):(\d{2}) (\d{4})$/'; $matches = array(); - if (preg_match ($formats['rfc1123'], $string, $matches)) + if (preg_match ($formats['rfc1123'], $string ?? "", $matches)) { $hours = $matches[5]; $minutes = $matches[6]; @@ -76,7 +76,7 @@ function HTTPDateToUnixTime ($string) $day = $matches[2]; $year = $matches[4]; } - elseif (preg_match ($formats['rfc850'], $string, $matches)) + elseif (preg_match ($formats['rfc850'], $string ?? "", $matches)) { $hours = $matches[5]; $minutes = $matches[6]; @@ -85,7 +85,7 @@ function HTTPDateToUnixTime ($string) $day = $matches[2]; $year = $matches[4]; } - elseif (preg_match ($formats['asctime'], $string, $matches)) + elseif (preg_match ($formats['asctime'], $string ?? "", $matches)) { $hours = $matches[4]; $minutes = $matches[5]; diff --git a/wwwroot/inc/functions.php b/wwwroot/inc/functions.php index 5a6fbdc9f..c75c1b2c3 100644 --- a/wwwroot/inc/functions.php +++ b/wwwroot/inc/functions.php @@ -1216,7 +1216,7 @@ function findAllEndpoints ($object_id, $fallback = '') // $record['href'] is set to URL if it is specified in the input value function parseWikiLink (&$record) { - if (! preg_match ('/^\[\[(.+)\]\]$/', $record['value'], $matches)) + if (! preg_match ('/^\[\[(.+)\]\]$/', $record['value'] ?? "", $matches)) $record['o_value'] = $record['value']; else { @@ -1233,7 +1233,7 @@ function execGMarker ($line) { return preg_replace ('/^.+%GSKIP%/', '', preg_replace ('/^(.+)%GPASS%/', '\\1 ', - preg_replace ('/%L\d+,\d+(H|V|)%/', '', $line))); + preg_replace ('/%L\d+,\d+(H|V|)%/', '', $line ?? ""))); } // extract the layout information from the %L...% marker in the dictionary info @@ -1402,7 +1402,7 @@ function parseAutoPortsConfig ($schema) { $ret = array(); - foreach (explode ('+', $schema) as $product) + foreach (explode ('+', $schema ?? "") as $product) { $tmp = explode ('*', $product); if (count ($tmp) > 4 || count ($tmp) < 3) diff --git a/wwwroot/inc/interface-lib.php b/wwwroot/inc/interface-lib.php index a8d7b34f8..927379d38 100644 --- a/wwwroot/inc/interface-lib.php +++ b/wwwroot/inc/interface-lib.php @@ -1210,14 +1210,14 @@ function stringForTD ($string, $maxlen = 30) function stringForTextInputValue ($string, $maxlen = 30) { if ($maxlen != 0) - $string = mb_substr ($string, 0, $maxlen); + $string = mb_substr ($string ?? "", 0, $maxlen); return htmlspecialchars ($string, ENT_QUOTES, 'UTF-8'); } // "" function stringForTextarea ($string) { - return htmlspecialchars ($string, ENT_QUOTES, 'UTF-8'); + return htmlspecialchars ($string ?? "", ENT_QUOTES, 'UTF-8'); } // diff --git a/wwwroot/inc/popup.php b/wwwroot/inc/popup.php index dfc2f717c..d6d0f484c 100644 --- a/wwwroot/inc/popup.php +++ b/wwwroot/inc/popup.php @@ -137,7 +137,7 @@ function findSparePorts ($port_info, $filter) } $rows_by_pn = array(); } - $prev_object_id = $row['object_id']; + $prev_object_id = $row['object_id'] ?? ""; if ($row) $rows_by_pn[$row['name']][] = $row; else diff --git a/wwwroot/inc/solutions.php b/wwwroot/inc/solutions.php index 1f8b1ea2a..4d6757764 100644 --- a/wwwroot/inc/solutions.php +++ b/wwwroot/inc/solutions.php @@ -472,7 +472,7 @@ function proxyStaticURI ($URI) if ( ! preg_match (RE_STATIC_URI, $URI, $matches) || - ! array_key_exists (strtolower ($matches[1]), $content_type) + ! array_key_exists (strtolower ($matches[1] ?? ""), $content_type) ) printStatic404(); global $local_staticdir, $racktables_staticdir;