Fix php warnings w/ null coalescing operator for $_POST keys

This commit is contained in:
billz 2024-12-16 18:39:33 -08:00
parent 168dd18679
commit 26c64d42e6

View File

@ -280,10 +280,10 @@ function updateDnsmasqConfig($iface,$status)
$config .='log-facility='.RASPI_DHCPCD_LOG.PHP_EOL;
$config .='conf-dir=/etc/dnsmasq.d'.PHP_EOL;
// handle log option
if ($_POST['log-dhcp'] == "1") {
if (($_POST['log-dhcp'] ?? '') == "1") {
$config .= "log-dhcp".PHP_EOL;
}
if ($_POST['log-queries'] == "1") {
if (($_POST['log-queries'] ?? '') == "1") {
$config .= "log-queries".PHP_EOL;
}
$config .= PHP_EOL;
@ -317,12 +317,12 @@ function updateDHCPConfig($iface,$status)
if ($_POST['Metric'] !== '') {
$cfg[] = 'metric '.$_POST['Metric'];
}
if ($_POST['Fallback'] == 1) {
if (($_POST['Fallback'] ?? 0) == 1) {
$cfg[] = 'profile static_'.$iface;
$cfg[] = 'fallback static_'.$iface;
}
$cfg[] = $_POST['DefaultRoute'] == '1' ? 'gateway' : 'nogateway';
if (( substr($iface, 0, 2) === "wl") && $_POST['NoHookWPASupplicant'] == '1') {
$cfg[] = ($_POST['DefaultRoute'] ?? '') == '1' ? 'gateway' : 'nogateway';
if (substr($iface, 0, 2) === "wl" && ($_POST['NoHookWPASupplicant'] ?? '') == '1') {
$cfg[] = 'nohook wpa_supplicant';
}
$dhcp_cfg = file_get_contents(RASPI_DHCPCD_CONFIG);