summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2023-10-06 15:52:35 +0200
committerSimon Rettberg2023-10-06 15:52:35 +0200
commit29c19060614ec2056a7dfa90415057f19191a404 (patch)
tree5ea21ee74fb7043add4ea7e7e6004114515e7583
parent[inc/Database] Fix return type (diff)
downloadslx-admin-29c19060614ec2056a7dfa90415057f19191a404.tar.gz
slx-admin-29c19060614ec2056a7dfa90415057f19191a404.tar.xz
slx-admin-29c19060614ec2056a7dfa90415057f19191a404.zip
Fix a few deprecation warnings on PHP 8.2
-rw-r--r--inc/database.inc.php4
-rw-r--r--inc/taskmanager.inc.php2
-rw-r--r--modules-available/statistics/pages/summary.inc.php4
3 files changed, 6 insertions, 4 deletions
diff --git a/inc/database.inc.php b/inc/database.inc.php
index 81fd3259..0c8f40ae 100644
--- a/inc/database.inc.php
+++ b/inc/database.inc.php
@@ -268,7 +268,7 @@ class Database
$log = true;
}
foreach ($row as $key => $col) {
- $l = strlen($col);
+ $l = strlen((string)($col ?? 'NULL'));
if ($l > $lens[$key]) {
$lens[$key] = $l;
}
@@ -289,7 +289,7 @@ class Database
foreach ($rows as $row) {
$line = '';
foreach ($lens as $key => $len) {
- $line .= '| '. str_pad($row[$key], $len) . ' ';
+ $line .= '| '. str_pad((string)($row[$key] ?? 'NULL'), $len) . ' ';
}
error_log($line . "|");
}
diff --git a/inc/taskmanager.inc.php b/inc/taskmanager.inc.php
index 4e534018..700ea4ad 100644
--- a/inc/taskmanager.inc.php
+++ b/inc/taskmanager.inc.php
@@ -141,7 +141,7 @@ class Taskmanager
$done = false;
$deadline = microtime(true) + $timeout / 1000;
while (($remaining = $deadline - microtime(true)) > 0) {
- usleep(min(100000, $remaining * 100000));
+ usleep((int)min(100000, $remaining * 100000));
$status = self::status($task);
if (!isset($status['statusCode']))
break;
diff --git a/modules-available/statistics/pages/summary.inc.php b/modules-available/statistics/pages/summary.inc.php
index ce16b536..8b476f36 100644
--- a/modules-available/statistics/pages/summary.inc.php
+++ b/modules-available/statistics/pages/summary.inc.php
@@ -26,7 +26,9 @@ class SubPage
// Prepare chart colors
self::$STATS_COLORS = [];
for ($i = 0; $i < 10; ++$i) {
- self::$STATS_COLORS[] = '#55' . sprintf('%02s%02s', dechex((($i + 1) * ($i + 1)) / .3922), dechex(abs((5 - $i) * 51)));
+ self::$STATS_COLORS[] = '#55' . sprintf('%02s%02s', dechex(
+ (int)((($i + 1) * ($i + 1)) / .3922)),
+ dechex((int)(abs((5 - $i) * 51))));
}
$filterSet->filterNonClients();