소스 검색

kdig(): ignore lines starting with semicolon in json

Miraty 1 년 전
부모
커밋
a65b3b24ce
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      fn/common.php

+ 3 - 0
fn/common.php

@@ -36,6 +36,9 @@ function kdig(string $name, string $type, string $server = NULL): array {
 	], $output, $code);
 	if ($code !== 0)
 		throw new KdigException($name . ' ' . $type . ' resolution failed.');
+	foreach ($output as &$line)
+		if (str_starts_with($line, ';'))
+			$line = '';
 	return json_decode(implode(LF, $output), true, flags: JSON_THROW_ON_ERROR);
 }