diff --git a/src/www/services_dnsmasq.php b/src/www/services_dnsmasq.php index 47f258f9a..058cd207c 100644 --- a/src/www/services_dnsmasq.php +++ b/src/www/services_dnsmasq.php @@ -53,8 +53,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { // simple text types $pconfig['port'] = !empty($a_dnsmasq['port']) ? $a_dnsmasq['port'] : ""; $pconfig['dns_forward_max'] = !empty($a_dnsmasq['dns_forward_max']) ? $a_dnsmasq['dns_forward_max'] : ""; - $pconfig['cache_size'] = !empty($a_dnsmasq['cache_size']) ? $a_dnsmasq['cache_size'] : ""; - $pconfig['local_ttl'] = !empty($a_dnsmasq['local_ttl']) ? $a_dnsmasq['local_ttl'] : ""; + $pconfig['cache_size'] = isset($a_dnsmasq['cache_size']) ? $a_dnsmasq['cache_size'] : ''; + $pconfig['local_ttl'] = isset($a_dnsmasq['local_ttl']) ? $a_dnsmasq['local_ttl'] : ''; // arrays $pconfig['interface'] = !empty($a_dnsmasq['interface']) ? explode(",", $a_dnsmasq['interface']) : array(); @@ -72,10 +72,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { if (!empty($pconfig['dns_forward_max']) && !is_numericint($pconfig['dns_forward_max'])) { $input_errors[] = gettext("You must specify a valid maximum number of DNS queries"); } - if (!empty($pconfig['cache_size']) && !is_numericint($pconfig['cache_size'])) { + if (isset($pconfig['cache_size']) && $pconfig['cache_size'] !== '' && !is_numericint($pconfig['cache_size'])) { $input_errors[] = gettext("You must specify a valid cache size"); } - if (!empty($pconfig['local_ttl']) && !is_numericint($pconfig['local_ttl'])) { + if (isset($pconfig['local_ttl']) && $pconfig['local_ttl'] !== '' && !is_numericint($pconfig['local_ttl'])) { $input_errors[] = gettext("You must specify a valid TTL for local DNS"); } $unbound_port = empty($config['unbound']['port']) ? "53" : $config['unbound']['port']; @@ -117,12 +117,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { } elseif (isset($a_dnsmasq['dns_forward_max'])) { unset($a_dnsmasq['dns_forward_max']); } - if (!empty($pconfig['cache_size'])) { + if (isset($pconfig['cache_size']) && $pconfig['cache_size'] !== '') { $a_dnsmasq['cache_size'] = $pconfig['cache_size']; } elseif (isset($a_dnsmasq['cache_size'])) { unset($a_dnsmasq['cache_size']); } - if (!empty($pconfig['local_ttl'])) { + if (isset($pconfig['local_ttl'])&& $pconfig['local_ttl'] !== '') { $a_dnsmasq['local_ttl'] = $pconfig['local_ttl']; } elseif (isset($a_dnsmasq['local_ttl'])) { unset($a_dnsmasq['local_ttl']); @@ -392,7 +392,7 @@ $( document ).ready(function() {