You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Owing to how concurrent HTTP requests using the HTTP client are executed (using promises), an exception can be encountered due to a sometimes incorrect type hint. Specifically line 1010 within the makePromise method of Illuminate/Http/Client/PendingRequest.
In some situations, the exception that is thrown is not a TransferException, but an OutOfBoundsException. It may be preferable to remove the type hint.
Steps To Reproduce
When using the Http Client to send concurrent requests e.g.
TypeError: Illuminate\Http\Client\PendingRequest::Illuminate\Http\Client\{closure}(): Argument #1 ($e) must be of type GuzzleHttp\Exception\TransferException, OutOfBoundsException given, called in /vendor/guzzlehttp/promises/src/RejectedPromise.php on line 49
The error relates to the TransferException type hint within Illuminate/Http/Client/PendingRequest on line 1010. If the type hint is removed the test runs as expected.
This error is not present when sending requests separately (not concurrently) as promises are not used.
The text was updated successfully, but these errors were encountered:
mattkingshott
changed the title
Using the Http Client Fake sequence with Pool triggers a TypeError exception
Using a Http Client Fake sequence with Pool triggers a TypeError exception
Nov 7, 2023
As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.
If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.
* Update PendingRequest.php
This fixes#48938 by making the parameter a union type and adding `OutOfBoundsException`.
* Update PendingRequest.php
Fix styling.
* Update PendingRequest.php
* formatting
---------
Co-authored-by: Taylor Otwell <[email protected]>
Laravel Version
10.30.1
PHP Version
8.2.11
Database Driver & Version
No response
Description
Owing to how concurrent HTTP requests using the HTTP client are executed (using promises), an exception can be encountered due to a sometimes incorrect type hint. Specifically line 1010 within the
makePromise
method ofIlluminate/Http/Client/PendingRequest
.In some situations, the exception that is thrown is not a
TransferException
, but anOutOfBoundsException
. It may be preferable to remove the type hint.Steps To Reproduce
When using the Http Client to send concurrent requests e.g.
And writing a test that fakes a corresponding Http response sequence e.g.
The following exception is thrown:
The error relates to the
TransferException
type hint withinIlluminate/Http/Client/PendingRequest
on line 1010. If the type hint is removed the test runs as expected.This error is not present when sending requests separately (not concurrently) as promises are not used.
The text was updated successfully, but these errors were encountered: