From a65b3b24ce9dec3cc194c828b631a9ddf555a2c3 Mon Sep 17 00:00:00 2001 From: Miraty Date: Wed, 10 Apr 2024 00:03:46 +0200 Subject: [PATCH] kdig(): ignore lines starting with semicolon in json --- fn/common.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fn/common.php b/fn/common.php index b687ff0..5e7745c 100644 --- a/fn/common.php +++ b/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); }