From 252eb90d06acea9b534ae0850ac61c92dc7fb52b Mon Sep 17 00:00:00 2001 From: Niklas Keller Date: Mon, 9 Oct 2017 10:50:12 +0200 Subject: [PATCH] Fix borked v3.0.7 release with null pointer access --- CHANGELOG.md | 6 +++++- lib/DefaultClient.php | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 137aad1..24cf36c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog -## 3.0.7 +## 3.0.8 + + - Fixed null pointer access in response handling completely breaking the client. + +## 3.0.7 [ borked ] - Clean references correctly, so unused bodies aren't consumed and the connection is closed. diff --git a/lib/DefaultClient.php b/lib/DefaultClient.php index 076e939..f4ba485 100644 --- a/lib/DefaultClient.php +++ b/lib/DefaultClient.php @@ -250,6 +250,7 @@ private function doRead(RequestCycle $requestCycle, ClientSocket $socket): \Gene $parseResult["headers"] = \array_change_key_case($parseResult["headers"], \CASE_LOWER); $response = $this->finalizeResponse($requestCycle, $parseResult, $connectionInfo); + $shouldCloseSocketAfterResponse = $this->shouldCloseSocketAfterResponse($response); if ($requestCycle->deferred) { $deferred = $requestCycle->deferred; @@ -293,7 +294,7 @@ private function doRead(RequestCycle $requestCycle, ClientSocket $socket): \Gene } } - if ($this->shouldCloseSocketAfterResponse($response)) { + if ($shouldCloseSocketAfterResponse) { $this->socketPool->clear($socket); $socket->close(); } else {