Repository navigation
fix(php): support guzzlehttp/psr7 v3 - #6945
Merged
Merged
Conversation
Contributor
✔️ Code generated!
📊 Benchmark resultsBenchmarks performed on the method using a mock server, the results might not reflect the real-world performance.
|
Summary by Aikido
⚡ Enhancements
🐛 Bugfixes
|
Allowing guzzlehttp/psr7 ^3.0 makes guzzlehttp/guzzle 8 installable alongside the client for the first time, and Algolia::getHttpClient() selects GuzzleHttpClient for any major >= 6. Guzzle 8 moved no-response failures out of ConnectException into a new NetworkException family, so read timeouts and resets escaped both catch arms and bypassed the host retry loop. Catch the PSR-18 NetworkExceptionInterface instead, which both majors tag those failures with. Guzzle 8 also dropped RequestException::hasResponse(), which fataled the response branch. Also refresh composer.lock for the widened psr7 range.
eric-zaharia
force-pushed
the
fix/php-psr7-v3
branch
from
August 24, 2026 11:26
4276604 to
1433656
Compare
Guzzle 8 splits read timeouts by whether response headers already arrived. Without a response it throws NetworkTimeoutException, but once headers are in it throws ResponseTimeoutException, which extends RequestException and always carries a response -- so the NetworkExceptionInterface arm missed it and the truncated response was returned as a success. A partial body then surfaced as a DeserializationException that the retry loop rethrows without failing over, and an empty body returned null as a successful result. Guzzle 7 raised ConnectException here and retried, so catch ResponseTimeoutException alongside NetworkExceptionInterface. The class does not exist in guzzle 7, where the arm is inert.
MarioAlexandruDan
previously approved these changes
Aug 25, 2026
MarioAlexandruDan
approved these changes
Aug 25, 2026
eric-zaharia
enabled auto-merge (squash)
August 25, 2026 14:30
algolia-api-clients-automation-bot Bot
added a commit
that referenced
this pull request
Aug 25, 2026
Co-authored-by: Eric Zaharia <94015633+eric-zaharia@users.noreply.github.com>
algolia-api-clients-automation-bot Bot
added a commit
to algolia/algoliasearch-client-csharp
that referenced
this pull request
Aug 25, 2026
algolia/api-clients-automation#6945 Co-authored-by: algolia-api-clients-automation-bot[bot] <288895823+algolia-api-clients-automation-bot[bot]@users.noreply.github.com> Co-authored-by: Eric Zaharia <94015633+eric-zaharia@users.noreply.github.com>
algolia-api-clients-automation-bot Bot
added a commit
to algolia/algoliasearch-client-dart
that referenced
this pull request
Aug 25, 2026
algolia/api-clients-automation#6945 Co-authored-by: algolia-api-clients-automation-bot[bot] <288895823+algolia-api-clients-automation-bot[bot]@users.noreply.github.com> Co-authored-by: Eric Zaharia <94015633+eric-zaharia@users.noreply.github.com>
algolia-api-clients-automation-bot Bot
added a commit
to algolia/algoliasearch-client-go
that referenced
this pull request
Aug 25, 2026
algolia/api-clients-automation#6945 Co-authored-by: algolia-api-clients-automation-bot[bot] <288895823+algolia-api-clients-automation-bot[bot]@users.noreply.github.com> Co-authored-by: Eric Zaharia <94015633+eric-zaharia@users.noreply.github.com>
algolia-api-clients-automation-bot Bot
added a commit
to algolia/algoliasearch-client-java
that referenced
this pull request
Aug 25, 2026
algolia/api-clients-automation#6945 Co-authored-by: algolia-api-clients-automation-bot[bot] <288895823+algolia-api-clients-automation-bot[bot]@users.noreply.github.com> Co-authored-by: Eric Zaharia <94015633+eric-zaharia@users.noreply.github.com>
algolia-api-clients-automation-bot Bot
added a commit
to algolia/algoliasearch-client-javascript
that referenced
this pull request
Aug 25, 2026
algolia/api-clients-automation#6945 Co-authored-by: algolia-api-clients-automation-bot[bot] <288895823+algolia-api-clients-automation-bot[bot]@users.noreply.github.com> Co-authored-by: Eric Zaharia <94015633+eric-zaharia@users.noreply.github.com>
algolia-api-clients-automation-bot Bot
added a commit
to algolia/algoliasearch-client-kotlin
that referenced
this pull request
Aug 25, 2026
algolia/api-clients-automation#6945 Co-authored-by: algolia-api-clients-automation-bot[bot] <288895823+algolia-api-clients-automation-bot[bot]@users.noreply.github.com> Co-authored-by: Eric Zaharia <94015633+eric-zaharia@users.noreply.github.com>
algolia-api-clients-automation-bot Bot
added a commit
to algolia/algoliasearch-client-php
that referenced
this pull request
Aug 25, 2026
algolia/api-clients-automation#6945 Co-authored-by: algolia-api-clients-automation-bot[bot] <288895823+algolia-api-clients-automation-bot[bot]@users.noreply.github.com> Co-authored-by: Eric Zaharia <94015633+eric-zaharia@users.noreply.github.com>
algolia-api-clients-automation-bot Bot
added a commit
to algolia/algoliasearch-client-python
that referenced
this pull request
Aug 25, 2026
algolia/api-clients-automation#6945 Co-authored-by: algolia-api-clients-automation-bot[bot] <288895823+algolia-api-clients-automation-bot[bot]@users.noreply.github.com> Co-authored-by: Eric Zaharia <94015633+eric-zaharia@users.noreply.github.com>
algolia-api-clients-automation-bot Bot
added a commit
to algolia/algoliasearch-client-ruby
that referenced
this pull request
Aug 25, 2026
algolia/api-clients-automation#6945 Co-authored-by: algolia-api-clients-automation-bot[bot] <288895823+algolia-api-clients-automation-bot[bot]@users.noreply.github.com> Co-authored-by: Eric Zaharia <94015633+eric-zaharia@users.noreply.github.com>
algolia-api-clients-automation-bot Bot
added a commit
to algolia/algoliasearch-client-scala
that referenced
this pull request
Aug 25, 2026
algolia/api-clients-automation#6945 Co-authored-by: algolia-api-clients-automation-bot[bot] <288895823+algolia-api-clients-automation-bot[bot]@users.noreply.github.com> Co-authored-by: Eric Zaharia <94015633+eric-zaharia@users.noreply.github.com>
algolia-api-clients-automation-bot Bot
added a commit
to algolia/algoliasearch-client-swift
that referenced
this pull request
Aug 25, 2026
algolia/api-clients-automation#6945 Co-authored-by: algolia-api-clients-automation-bot[bot] <288895823+algolia-api-clients-automation-bot[bot]@users.noreply.github.com> Co-authored-by: Eric Zaharia <94015633+eric-zaharia@users.noreply.github.com>
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.
🧭 What and Why
🎟 JIRA Ticket: API-551
composer require algolia/algoliasearch-client-phpfails on modern Laravel apps, which lockguzzlehttp/psr7to^3.0.Fixes algolia/algoliasearch-client-php#762.
Changes included:
guzzlehttp/psr7constraint to^2.0 || ^3.0.GuzzleHttpClient. psr7^3.0makes guzzle 8 installable alongside the client for the first time, and guzzle 8 reclassified transfer failures four ways:ConnectExceptioninto a newNetworkExceptionfamily, so they escaped both catch arms and bypassed the host retry loop entirely. Catch the PSR-18NetworkExceptionInterfacethat both majors tag those failures with.ResponseTimeoutException, which extendsRequestExceptionand carries a non-nullable response, so the truncated response was returned as a success: a partial body surfaced as aDeserializationExceptionthat the retry loop rethrows without failing over, and an empty body returnednullas a successful result. Catch it alongsideNetworkExceptionInterface, restoring guzzle 7's behaviour of raisingTimeoutExceptionand retrying. The class does not exist in guzzle 7, where the arm is inert.RequestException::hasResponse()was dropped, which fataled the response branch. Probe forgetResponse()instead, which also maps cleanly onto guzzle 8'sResponseExceptionsplit.HandlerClosedException, which hangs offTransferExceptiondirectly and so matched neither arm — it escaped the retry loop as a raw guzzle exception. Catch it alongside the network failures. Also guzzle-8-only, so the arm is inert on guzzle 7.composer.lockfor the widened range.🧪 Test
CTS passes against psr7 3.0.0.
GuzzleHttpClientverified against real installs of guzzle 8.1.0 / psr7 3.1.0 and guzzle 7.15.5 / psr7 2.13.1, driving the client against a fault-injection server. Both majors agree on every tested scenario: read timeouts (with a partial body and with none) and connection refused raiseTimeoutExceptionand retry across hosts, 2xx and 5xx return the response, and an early connection close returns the partial response — matching guzzle 7's long-standing behaviour, which is byte-identical before and after this PR.Guzzle 8 does classify more low-level curl errors as network failures than guzzle 7's
ConnectExceptiondid, so a few outside those scenarios — a connection reset before headers, say — now take theTimeoutExceptionretry path rather than the status-0 one. Both fail over and both exhaust intoUnreachableException.