From b7a6d334e3fb18f02e9abea0b2bcd0c49bf47d26 Mon Sep 17 00:00:00 2001 From: billz Date: Mon, 16 Dec 2024 18:19:15 -0800 Subject: [PATCH] Fix ParseConfig() handling of name-only options, thx @meandthemachine --- includes/functions.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/includes/functions.php b/includes/functions.php index b50bafb4..859f67ed 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -54,7 +54,7 @@ function cidr2mask($cidr) { $ipParts = explode('/', $cidr); $ip = $ipParts[0]; - $prefixLength = $ipParts[1]; + $prefixLength = $ipParts[1] ?? null; $ipLong = ip2long($ip); $netmaskLong = bindec(str_pad(str_repeat('1', $prefixLength), 32, '0')); @@ -458,6 +458,9 @@ function ParseConfig($arrConfig, $wg = false) if (strpos($line, "=") !== false) { list($option, $value) = array_map("trim", explode("=", $line, 2)); + } else { + $option = $line; + $value = ""; } if (empty($config[$option])) { $config[$option] = $value ?: true;