From 3a9789c57c2ca47d074d2f4d25dc9102a0da9ae3 Mon Sep 17 00:00:00 2001 From: Matt Kingshott <51963402+mattkingshott@users.noreply.github.com> Date: Tue, 7 Nov 2023 15:56:44 +0000 Subject: [PATCH 1/4] Update PendingRequest.php This fixes #48938 by making the parameter a union type and adding `OutOfBoundsException`. --- src/Illuminate/Http/Client/PendingRequest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Http/Client/PendingRequest.php b/src/Illuminate/Http/Client/PendingRequest.php index ba910f833111..dac9fb16ea09 100644 --- a/src/Illuminate/Http/Client/PendingRequest.php +++ b/src/Illuminate/Http/Client/PendingRequest.php @@ -23,6 +23,7 @@ use Illuminate\Support\Traits\Conditionable; use Illuminate\Support\Traits\Macroable; use JsonSerializable; +use OutOfBoundsException; use Psr\Http\Message\MessageInterface; use Psr\Http\Message\RequestInterface; use RuntimeException; @@ -1007,7 +1008,7 @@ protected function makePromise(string $method, string $url, array $options = []) $this->dispatchResponseReceivedEvent($response); }); }) - ->otherwise(function (TransferException $e) { + ->otherwise(function (TransferException | OutOfBoundsException $e) { if ($e instanceof ConnectException) { $this->dispatchConnectionFailedEvent(); } From f2e25fb1e0573f7567762ab0c752c59e0dc9392c Mon Sep 17 00:00:00 2001 From: Matt Kingshott <51963402+mattkingshott@users.noreply.github.com> Date: Tue, 7 Nov 2023 16:07:47 +0000 Subject: [PATCH 2/4] Update PendingRequest.php Fix styling. --- src/Illuminate/Http/Client/PendingRequest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Http/Client/PendingRequest.php b/src/Illuminate/Http/Client/PendingRequest.php index dac9fb16ea09..e850fce3d261 100644 --- a/src/Illuminate/Http/Client/PendingRequest.php +++ b/src/Illuminate/Http/Client/PendingRequest.php @@ -1008,7 +1008,7 @@ protected function makePromise(string $method, string $url, array $options = []) $this->dispatchResponseReceivedEvent($response); }); }) - ->otherwise(function (TransferException | OutOfBoundsException $e) { + ->otherwise(function (TransferException|OutOfBoundsException $e) { if ($e instanceof ConnectException) { $this->dispatchConnectionFailedEvent(); } From 40f44da03adc020480da587e9a9ed2cfe4e9c94b Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 7 Nov 2023 10:18:32 -0600 Subject: [PATCH 3/4] Update PendingRequest.php --- src/Illuminate/Http/Client/PendingRequest.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Illuminate/Http/Client/PendingRequest.php b/src/Illuminate/Http/Client/PendingRequest.php index e850fce3d261..79be26514f37 100644 --- a/src/Illuminate/Http/Client/PendingRequest.php +++ b/src/Illuminate/Http/Client/PendingRequest.php @@ -23,7 +23,6 @@ use Illuminate\Support\Traits\Conditionable; use Illuminate\Support\Traits\Macroable; use JsonSerializable; -use OutOfBoundsException; use Psr\Http\Message\MessageInterface; use Psr\Http\Message\RequestInterface; use RuntimeException; @@ -1008,7 +1007,7 @@ protected function makePromise(string $method, string $url, array $options = []) $this->dispatchResponseReceivedEvent($response); }); }) - ->otherwise(function (TransferException|OutOfBoundsException $e) { + ->otherwise(function ($e) { if ($e instanceof ConnectException) { $this->dispatchConnectionFailedEvent(); } From f934ef33287df766c20374d3cd8ecd7b2b1686a6 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 7 Nov 2023 10:20:59 -0600 Subject: [PATCH 4/4] formatting --- src/Illuminate/Http/Client/PendingRequest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Http/Client/PendingRequest.php b/src/Illuminate/Http/Client/PendingRequest.php index 79be26514f37..78e361feffad 100644 --- a/src/Illuminate/Http/Client/PendingRequest.php +++ b/src/Illuminate/Http/Client/PendingRequest.php @@ -23,6 +23,7 @@ use Illuminate\Support\Traits\Conditionable; use Illuminate\Support\Traits\Macroable; use JsonSerializable; +use OutOfBoundsException; use Psr\Http\Message\MessageInterface; use Psr\Http\Message\RequestInterface; use RuntimeException; @@ -1007,7 +1008,7 @@ protected function makePromise(string $method, string $url, array $options = []) $this->dispatchResponseReceivedEvent($response); }); }) - ->otherwise(function ($e) { + ->otherwise(function (OutOfBoundsException|TransferException $e) { if ($e instanceof ConnectException) { $this->dispatchConnectionFailedEvent(); }