Fix PHP errors

This commit is contained in:
bergware
2025-02-13 23:16:43 +01:00
parent f9d14436ad
commit c3558c2f8b
2 changed files with 2 additions and 2 deletions

View File

@@ -24,7 +24,7 @@ function port($eth) {
$sys = "/sys/class/net";
if (substr($eth,0,4)=='wlan') return $eth;
$x = preg_replace('/[^0-9]/','',$eth);
return file_exists("$sys/br{$x}") ? "br${x}" : (file_exists("$sys/bond{$x}") ? "bond{$x}" : "eth{$x}");
return file_exists("$sys/br{$x}") ? "br{$x}" : (file_exists("$sys/bond{$x}") ? "bond{$x}" : "eth{$x}");
}
exec("grep -Po 'nameserver \K\S+' /etc/resolv.conf 2>/dev/null",$ns);

View File

@@ -270,6 +270,6 @@ function check_network_connectivity(): bool {
function lan_port($port, $state=false) {
$system = '/sys/class/net';
$exist = file_exists("$system/$port");
return !$state ? $exist : ($exist ? file_get_contents("$system/$port/carrier") : false);
return !$state ? $exist : ($exist ? (@file_get_contents("$system/$port/carrier") ?: 0) : false);
}
?>