diff --git a/lib/classes/ssl/class.lescript.php b/lib/classes/ssl/class.lescript.php index ab4a30a3..305a3502 100644 --- a/lib/classes/ssl/class.lescript.php +++ b/lib/classes/ssl/class.lescript.php @@ -100,9 +100,13 @@ class lescript array("resource" => "new-authz", "identifier" => array("type" => "dns", "value" => $domain)) ); + if (!array_key_exists('challenges', $response)) { + throw new RuntimeException("No challenges received for $domain. Whole response: ".json_encode($response)); + } + // choose http-01 challange only $challenge = array_reduce($response['challenges'], function($v, $w) { return $v ? $v : ($w['type'] == 'http-01' ? $w : false); }); - if(!$challenge) throw new \RuntimeException("HTTP Challenge for $domain is not available. Whole response: ".json_encode($response)); + if(!$challenge) throw new RuntimeException("HTTP Challenge for $domain is not available. Whole response: ".json_encode($response)); $this->log("Got challenge token for $domain"); $location = $this->client->getLastLocation();