Skip to content

Commit f6b66cf

Browse files
committed
Fix judgehost check if its enabled
array_filter would only filter out the other judgehosts but still return an array of judgehost objects. By selecting the first (and only item) we can now get the `enabled` property and properly check. ``` array(1) { [1]=> array(5) { ["id"]=> string(1) "2" ["hostname"]=> string(8) "judgehost" ["enabled"]=> bool(true) ["polltime"]=> string(20) "1728821560.017400000" ["hidden"]=> bool(false) } } ```
1 parent fccf20c commit f6b66cf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

judge/judgedaemon.main.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ function fetch_executable_internal(
768768
$judgehosts = request('judgehosts', 'GET');
769769
if ($judgehosts !== null) {
770770
$judgehosts = dj_json_decode($judgehosts);
771-
$judgehost = array_filter($judgehosts, fn($j) => $j['hostname'] === $myhost);
771+
$judgehost = array_values(array_filter($judgehosts, fn($j) => $j['hostname'] === $myhost))[0];
772772
if (!isset($judgehost['enabled']) || !$judgehost['enabled']) {
773773
logmsg(LOG_WARNING, "Judgehost needs to be enabled in web interface.");
774774
}

0 commit comments

Comments
 (0)