Skip to content

Commit

Permalink
Check if dns_get_record returns non-false
Browse files Browse the repository at this point in the history
`dns_get_record` can return false which results in exceptions such as
the ones shown in #27870.

Signed-off-by: Lukas Reschke <[email protected]>
  • Loading branch information
LukasReschke committed Jul 12, 2021
1 parent a8aeaa6 commit b0cef88
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/private/Http/Client/DnsPinMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private function dnsResolve(string $target, int $recursionCount) : array {

$dnsResponses = dns_get_record($target, $dnsType);
$canHaveCnameRecord = true;
if (count($dnsResponses) > 0) {
if ($dnsResponses && count($dnsResponses) > 0) {
foreach ($dnsResponses as $dnsResponse) {
if (isset($dnsResponse['ip'])) {
$targetIps[] = $dnsResponse['ip'];
Expand Down

0 comments on commit b0cef88

Please sign in to comment.