Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update error handling in Stream::getContents() #169

Merged
merged 2 commits into from
Nov 18, 2023

Conversation

rancoud
Copy link
Owner

@rancoud rancoud commented Nov 18, 2023

Description

Related to that Pull Request Nyholm/psr7#252

The current implementation of stream_get_contents() swallows errors, leading to issues like symfony/symfony#52490, where errors reported by the stream layer aren't propagated to user-land.

This is even in the C source:
https://github.com/php/php-src/blob/311cae03e730c76aed343312319ed8cf1c37ade0/main/streams/streams.c#L1512

Changelist

  • Update Stream::getContents()
  • Add tests

Copy link

codecov bot commented Nov 18, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (01d60b3) 100.00% compared to head (7e880b7) 100.00%.

Additional details and impacted files
@@             Coverage Diff             @@
##              master      #169   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
- Complexity       368       370    +2     
===========================================
  Files             11        11           
  Lines            866       875    +9     
===========================================
+ Hits             866       875    +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rancoud rancoud merged commit 021d3ce into master Nov 18, 2023
12 checks passed
@rancoud rancoud deleted the fix/error-stream-get-contents branch November 18, 2023 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant