diff --git a/scripts/pi-hole/php/savesettings.php b/scripts/pi-hole/php/savesettings.php index 6b536357..b558bba7 100644 --- a/scripts/pi-hole/php/savesettings.php +++ b/scripts/pi-hole/php/savesettings.php @@ -137,17 +137,21 @@ function readAdlists() { while (($line = fgets($handle)) !== false) { - if(substr($line, 0, 1) === "#") + if(strlen($line) < 3) + { + continue; + } + elseif($line[0] === "#") { // Comments start either with "##" or "# " - if(substr($line, 1, 1) !== "#" && - substr($line, 1, 1) !== " ") + if($line[1] !== "#" && + $line[1] !== " ") { // Commented list array_push($list, [false,rtrim(substr($line, 1))]); } } - elseif(strlen($line) > 1) + else { // Active list array_push($list, [true,rtrim($line)]);