Add previous exception to StreamException on socket accept failure#17
Merged
sirn-se merged 1 commit intosirn-se:main-v2from Dec 24, 2025
Conversation
Owner
|
Thanks for contribution! |
sirn-se
reviewed
Dec 13, 2025
Owner
|
Ok, it appears the missing cert file issue you're trying to provoke in the test does not cause exception until it has a stream accepted (which doesn't happen In the tests). So instead we end up with timeout exception in the test. As I see it, there's no need to test specific errors that may occur, only that they are properly handled in the code.
$this->expectExceptionMessage('Could not accept on socket.');to $this->expectExceptionMessage(
'Could not accept on socket. (stream_socket_accept(): Accept failed: Operation timed out)'
); |
65e18b6 to
ab05ef1
Compare
Contributor
Author
|
I processed all your feedback, I preferred to use a match on the exception message. |
Owner
|
Released as |
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.
Hello! 👋
I encountered an issue while working with SSL/TLS sockets where error messages were not informative enough to diagnose configuration problems.
When
stream_socket_accept()fails due to SSL/TLS configuration issues (e.g., inaccessible private key file), the original error message was lost and final users only saw:not accept on socket.Now the exception includes the original error details:
Could not accept on socket. (stream_socket_accept(): Unable to set private key file/certs/key.pem')`This makes debugging SSL/TLS configuration issues much easier.
Thank you for maintaining this library! Let me know if you'd like any changes to this PR.