From 11751baacedd89e20f60eb7d9c78d609c6a2cd01 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Mon, 12 Oct 2020 13:38:32 +0200 Subject: [PATCH] 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. --- wcfsetup/install/files/lib/util/HTTPRequest.class.php | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 = []; -- 2.20.1