Skip to content

Conversation

@Rafagd
Copy link
Contributor

@Rafagd Rafagd commented Nov 5, 2025

If rewind silently fails and the return is not checked, it's possible stream_get_contents will hang forever waiting for new input that will never come.

I have tested this on Linux and Linux on WSL and I couldn't reproduce the error, but it happens in our FreeBSD server.
I'm not sure if it's a FreeBSD quirk or something weird with our configs, but it seems like it's a sensible change to avoid reading the stream if it couldn't be rewound.

This is related to the issue: #6401

@sebastianbergmann sebastianbergmann added type/bug Something is broken platform/freebsd feature/process-isolation Issues related to running tests in separate PHP processes labels Nov 6, 2025
@codecov
Copy link

codecov bot commented Nov 6, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.32%. Comparing base (c6b89b6) to head (5f7b29c).
⚠️ Report is 1 commits behind head on 11.5.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@ Coverage Diff @@ ## 11.5 #6402 +/- ## ========================================= Coverage 95.32% 95.32% Complexity 7148 7148 ========================================= Files 737 737 Lines 21827 21827 ========================================= Hits 20807 20807 Misses 1020 1020 

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

@devnexen
Copy link

devnexen commented Nov 6, 2025

I was able to reproduce and indeed the php_stream_read part hangs. The fix looks right to me.

@sebastianbergmann
Copy link
Owner

Thank you, David, for taking the time to look into this!

@sebastianbergmann sebastianbergmann merged commit cf2498a into sebastianbergmann:11.5 Nov 6, 2025
37 checks passed
@sebastianbergmann sebastianbergmann changed the title Avoiding reading from STDOUT when rewind fails Avoiding reading from STDOUT when rewind() fails Nov 6, 2025
@sebastianbergmann sebastianbergmann self-assigned this Nov 6, 2025
@sebastianbergmann sebastianbergmann changed the title Avoiding reading from STDOUT when rewind() fails Avoid reading from STDOUT when rewind() fails Nov 6, 2025
@Rafagd
Copy link
Contributor Author

Rafagd commented Nov 6, 2025

Thanks for having a look at it @devnexen . Was I right that it's a FreeBSD thing?

Also thanks @sebastianbergmann for taking some time for this one too.

@devnexen
Copy link

devnexen commented Nov 6, 2025

Thanks for having a look at it @devnexen . Was I right that it's a FreeBSD thing?

It might or it might not. There are other platforms out there such as netbsd/openbsd ... solaris/illumos.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature/process-isolation Issues related to running tests in separate PHP processes platform/freebsd type/bug Something is broken

3 participants