From: Tim Düsterhus Date: Mon, 12 Oct 2020 11:38:32 +0000 (+0200) Subject: Fix calling HTTPRequest::getReply() if the response is missing X-Git-Tag: 5.3.0_RC_2~22 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=11751baacedd89e20f60eb7d9c78d609c6a2cd01;p=GitHub%2FWoltLab%2FWCF.git Fix calling HTTPRequest::getReply() if the response is missing The only case where the response might be missing is if Guzzle fails to connect to the remote server (ConnectException). Return default data that is consistent with 5.2 in this case. --- diff --git a/wcfsetup/install/files/lib/util/HTTPRequest.class.php b/wcfsetup/install/files/lib/util/HTTPRequest.class.php index e0eb6a2224..a3dd16ef89 100644 --- a/wcfsetup/install/files/lib/util/HTTPRequest.class.php +++ b/wcfsetup/install/files/lib/util/HTTPRequest.class.php @@ -261,6 +261,16 @@ final class HTTPRequest { * @return array */ public function getReply() { + if (!$this->response) { + return [ + 'statusCode' => 0, + 'headers' => [], + 'httpHeaders' => [], + 'body' => '', + 'url' => $this->url + ]; + } + $headers = []; $legacyHeaders = [];