Repository navigation
feat: add Guzzle 8 support - #103
Conversation
Allow guzzlehttp/guzzle ^7 || ^8 so customers on Guzzle 8 can install the SDK. Map no-response failures via NetworkExceptionInterface, avoid getHandlerContext() (removed in Guzzle 8), and configure CurlMultiHandler connection caps in a Guzzle 7/8-compatible way.
Guzzle 8 raises ResponseTimeoutException when a transfer times out after the response headers arrived. It is not a NetworkExceptionInterface, so it fell through to the generic catch and was reported as "unknown". Guzzle 7 reports the same failure as ConnectException, which maps to "timeout". Add a CI leg that resolves Guzzle 8, since composer.lock pins Guzzle 7 and the existing matrix never runs the Guzzle 8 code paths or tests. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
nijeesh-stream
left a comment
There was a problem hiding this comment.
Ran this against Guzzle 8.6.0 locally: unit suite, PHPStan, and real-socket failures (refused, DNS, connect timeout, TLS, empty reply, truncated body, plain 200 and 500). Nearly everything matched Guzzle 7. Two things didn't, and I pushed 1aab39b to fix both.
Fixed: a timeout after the response had started came back as unknown on Guzzle 8. If the server sends headers and then stalls, Guzzle 8 throws ResponseTimeoutException. That isn't a NetworkExceptionInterface, so it fell into the generic GuzzleException catch. Guzzle 7 reports the same failure as timeout. The generic catch now maps it to ERROR_TYPE_TIMEOUT, with a test (guzzle8ResponseTimeoutMapsToTimeoutErrorType) that fails if the mapping is removed.
Fixed: CI never ran Guzzle 8. composer.lock pins 7.10 and the workflow runs composer install, so all three PHP legs tested Guzzle 7 and the Guzzle 8 tests were skipped. There's now a Test & lint (8.3, Guzzle 8) job that resolves guzzlehttp/guzzle:^8.0 and runs the same lint and unit lane. It's green on this head.
Left alone:
composer.lockis out of date withcomposer.json, but it already is on master, so not this PR's problem.- The Guzzle 8 branch sets
max_total_connectionsto the per-host value. Guzzle 7 has no total cap. Fine while the SDK talks to one host; worth knowing if that changes.
The branch is 8 commits behind master. I merged master locally and both legs still pass, so no conflict there.
Allow guzzlehttp/guzzle ^7 || ^8 so customers on Guzzle 8 can install the
SDK. Map no-response failures via NetworkExceptionInterface, avoid
getHandlerContext() (removed in Guzzle 8), and configure CurlMultiHandler
connection caps in a Guzzle 7/8-compatible way.