Implement stream_eof
in FileReadTrapStreamWrapper
, disable OpCache on PHP < 7.4, #4881
#501
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.
Overview
This PR resolves PHPStan issue #4881 which had two parts:
stream_eof()
implementation, andzend_mm_heap corrupted
error messages, likely due to an OpCache issue.We address item 1 by implementing more of the stream wrapper.
We address item 2 by disabling OpCache for PHPStan when the version of PHP is earlier than 7.4.x.
Testing
Thanks to the diligent work of @alfredbez and others in the issue 4881 thread, we have a repository which allows for a Dockerized reproduction of the issue.
Before
After
e2e tests
It seems that the code triggering the EOF warnings relies on having PHPStan itself in
composer.json
, I was not sure how to craft a companion PR in thephpstan/phpstan
repository that would do this without introducing a circular dependency.