Repository navigation
[4.x] Fix Guzzle 8 transfer exceptions in GuzzleSender - #569
Merged
Sammyjo20 merged 3 commits intoOct 25, 2026
Merged
Conversation
JonPurvis
marked this pull request as ready for review
October 23, 2026 16:44
Contributor
Author
|
You're welcome! Thanks to @intrepidws for reporting! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #568
Thanks @intrepidws for the clear report and reproduction script.
Problem
Since Guzzle 8 (#561),
GuzzleSender::send()still only caughtConnectExceptionandRequestException. That left two gaps:NetworkException,NetworkTimeoutException, etc.) are no longerConnectException, so synchronoussend()let raw Guzzle exceptions escape. Saloon’s fatal pipeline and connector$triesretries never ran (send()only retriesFatalRequestException|RequestException).ResponseTransferException, e.g.ResponseTimeoutException) areRequestExceptions with a partial response, so Saloon returned a normalResponse(status 200,failed(): false) instead of treating the transfer as fatal.sendAsync()already wrapped (1) viaprocessPromise(); both paths were affected by (2).Reproduction
saloonphp/saloonv4.5.0 +guzzlehttp/guzzle8.3.0, connector$tries = 3,MockHandlerthrowing Guzzle 8 exception types (same script as the issue).Before (v4.5.0)
ConnectExceptionsendFatalRequestExceptionConnectExceptionsendAsyncFatalRequestExceptionNetworkTimeoutExceptionsendGuzzleHttp\Exception\NetworkTimeoutExceptionNetworkTimeoutExceptionsendAsyncFatalRequestExceptionNetworkExceptionsendGuzzleHttp\Exception\NetworkExceptionNetworkExceptionsendAsyncFatalRequestExceptionResponseTimeoutExceptionsendResponse(200,failed: false, partial body)ResponseTimeoutExceptionsendAsyncResponse(200,failed: false, partial body)After (this PR)
ConnectExceptionsendFatalRequestExceptionConnectExceptionsendAsyncFatalRequestExceptionNetworkTimeoutExceptionsendFatalRequestExceptionNetworkTimeoutExceptionsendAsyncFatalRequestExceptionNetworkExceptionsendFatalRequestExceptionNetworkExceptionsendAsyncFatalRequestExceptionResponseTimeoutExceptionsendFatalRequestExceptionResponseTimeoutExceptionsendAsyncFatalRequestExceptionSolution
TransferExceptioninsend()and wrap asFatalRequestException(aligned withprocessPromise()).responseFromRequestException()for sync + async: treat Guzzle 8ResponseTransferExceptionas fatal; keep existing behaviour for response-lessRequestExceptionand normal HTTP error responses.class_exists(ResponseTransferException::class)so Guzzle 7 is unaffected.Tests
tests/Feature/Guzzle8SenderExceptionTest.php(skipped when Guzzle 8 exception classes are not present).Test plan
Guzzle8SenderExceptionTest(on Guzzle 8)RequestExceptionTest/GuzzleSenderTeston Guzzle 7