Fix warning when handling HTTP request with missing Origin header
#1109
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.
This changeset fixes a warning when handling an HTTP request missing an
Originrequest header. A request without the required headers will not pass theOriginCheck, but it should not report a warning in either case. This is part 12 of reviving Ratchet as discussed in #1054, unblocking more future progress.The code in question hasn't been touched in a while. This condition used to cause a notice in legacy PHP < 8 and a warning as of PHP 8+ (https://3v4l.org/8uKnY). Since adding full PHP 8+ support with #1094, we should properly handle this in either case. Similar to #1107 and others, this wasn't caught by the previous tests because the
OriginCheckdoesn't have full test coverage. I've updated the tests to ensure this should not happen again. The test suite confirms this now has full test coverage and does not otherwise affect any of the existing tests.Overall, this required quite a massive effort. If you want to support this project, please consider sponsoring @reactphp ❤️
Builds on top of #1094, and others, one step closer to reviving Ratchet as discussed in #1054
Resolves / closes #954