diff --git a/src/Command/UpdateDnsCommand.php b/src/Command/UpdateDnsCommand.php index 193636b..474d850 100644 --- a/src/Command/UpdateDnsCommand.php +++ b/src/Command/UpdateDnsCommand.php @@ -69,8 +69,7 @@ class UpdateDnsCommand if ($data === null || !isset($data->records)) { - Console::echo("Invalid DNS records returned by Porkbun API:\n$records\n"); - return self::STATUS_ERROR; + return $this->fail("Invalid DNS records returned by Porkbun API: " . $records); } // Discard those records that are not type "A": @@ -83,6 +82,11 @@ class UpdateDnsCommand $updated = false; foreach ($filteredRecords as $record) { + if (!isset($record->id, $record->name, $record->content, $record->type)) + { + return $this->fail("Porkbun API returned a malformed DNS record."); + } + Console::echo("Porkbun's DNS for $record->name is pointing to $record->content... "); if ($record->content != $myIp)