`GuzzlePromiseAdapter::then()` breaks promise chaining by returning `$this`
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 36.9k
- Forks
- 5.2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 713
Description
I believe this is a bug; ran across while poking around at other matters.
OC\Http\Client\GuzzlePromiseAdapter::then() calls the underlying Guzzle promise’s then(...), but discards the returned promise and returns $this instead.
This breaks normal promise chaining semantics.
The current implementation also contradicts the IPromise::then() docs, which say it returns a new promise resolving to the handler’s return value.
For what it's worth, app_api is currently a consumer...
Also could use some unit tests for async contract behavior...
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in lib/private/Http/Client/GuzzlePromiseAdapter.php at GuzzlePromiseAdapter::then(), then compare its behavior with the IPromise::then() documentation and the underlying Guzzle promise. Add unit coverage for the async contract, including chaining and handler return values, and verify the app_api usage in lib/Service/AppAPIService.php remains compatible.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100