summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2024-03-04 15:13:04 +0100
committerSimon Rettberg2024-03-04 15:13:04 +0100
commite2bfae8d6218c6dbf12081003d2cc0b4e53caf7f (patch)
tree41949f47bb9487f53d09406eac3f395f4c23cd6e
parent[backup] Checking file existence is stupid if we write to /root/ (diff)
downloadslx-admin-master.tar.gz
slx-admin-master.tar.xz
slx-admin-master.zip
[rebootcontrol] Fix the "bogus" array to string warningHEADmaster
After all it wasn't bogus, but caused by array_unique internally casting everything to string by default, which causes a warning for arrays. Thankfully we have an elephant for figuring out things like this.
-rw-r--r--modules-available/rebootcontrol/inc/rebootcontrol.inc.php10
1 files changed, 6 insertions, 4 deletions
diff --git a/modules-available/rebootcontrol/inc/rebootcontrol.inc.php b/modules-available/rebootcontrol/inc/rebootcontrol.inc.php
index ab308084..107c2a50 100644
--- a/modules-available/rebootcontrol/inc/rebootcontrol.inc.php
+++ b/modules-available/rebootcontrol/inc/rebootcontrol.inc.php
@@ -401,15 +401,17 @@ class RebootControl
if (!empty($unknown)) {
$ips = ArrayUtil::flattenByKey($unknown, 'clientip');
$errors .= "**** WARNING ****\nThe following clients do not belong to a known subnet (bug?)\n" . implode("\n", $ips) . "\n";
+ foreach ($unknown as $val) {
+ $failed[$val['clientip']] = $val;
+ }
}
if (!empty($unreachable)) {
$ips = ArrayUtil::flattenByKey($unreachable, 'clientip');
$errors .= "**** WARNING ****\nThe following clients are not reachable with any method\n" . implode("\n", $ips) . "\n";
+ foreach ($unreachable as $val) {
+ $failed[$val['clientip']] = $val;
+ }
}
- // Work around bogus type warnings in PHP 7.0 by un-inlining the $failed assignment
- $tmp1 = array_merge($unknown, $unreachable);
- $tmp2 = array_unique($tmp1);
- $failed = $tmp2;
$task = Taskmanager::submit('WakeOnLan', [
'clients' => $taskClients,
'ssh' => $taskSsh,