yourivw / LEClient

An easy-to-use PHP ACME v2 client library, designed to be used with LetsEncrypt.
MIT License
204 stars 98 forks source link

LEAccount Warning if LetsEncrypt omits contact #126

Open skwirrel opened 1 year ago

skwirrel commented 1 year ago

We have experienced occassional warnings generated in LEAccount.php around line 136:

            $this->id = isset($post['body']['id']) ? $post['body']['id'] : '';
            $this->key = $post['body']['key'];
>>>     $this->contact = $post['body']['contact'];   <<< HERE

I'm not entirely sure why but it seems that LetsEncrypt sometimes fails to return a contact. Using a null coalescing operator to supply a default empty array fixed this for us thus: $this->contact = $post['body']['contact'] ?? [];

Hope that helps.