phpstan: FileReadTrapStreamWrapper::stream_eof is not implemented! since 0.12.84
Bug report
Since upgrading phpstan/phpstan (0.12.83 => 0.12.84), I encounter this error on CircleCI :
#!/bin/bash -eo pipefail php bin/phpstan analyse --no-interaction --no-progress Note: Using configuration file /home/circleci/project/symfony/phpstan.neon.dist. PHP Warning: include(): PHPStan\Reflection\BetterReflection\SourceLocator\FileReadTrapStreamWrapper::stream_eof is not implemented! Assuming EOF in phar:///home/circleci/project/symfony/vendor/phpstan/phpstan/phpstan.phar/vendor/composer/ClassLoader.php on line 478 Warning: include(): PHPStan\Reflection\BetterReflection\SourceLocator\FileReadTrapStreamWrapper::stream_eof is not implemented! Assuming EOF in phar:///home/circleci/project/symfony/vendor/phpstan/phpstan/phpstan.phar/vendor/composer/ClassLoader.php on line 478 zend_mm_heap corrupted
Exited with code exit status 1 CircleCI received exit code 1
Code snippet that reproduces the problem
Update phpstan to 0.12.84 and run php bin/phpstan analyse --no-interaction --no-progress with a custom config file :
includes:
- vendor/phpstan/phpstan-symfony/extension.neon
- vendor/phpstan/phpstan-symfony/rules.neon
parameters:
parallel:
maximumNumberOfProcesses: 1
level: 0
paths:
- src
- tests
excludes_analyse:
- tests/DataFixtures
tipsOfTheDay: false
symfony:
container_xml_path: '%rootDir%/../../../var/cache/test/App_KernelTestDebugContainer.xml'
ignoreErrors:
-
message: '#Unsafe usage of new static\(\)\.#'
paths:
- [...]
-
message: '#Service "[^"]+" is private\.#'
paths:
- [...]
Expected output
#!/bin/bash -eo pipefail php bin/phpstan analyse --no-interaction --no-progress Note: Using configuration file /home/circleci/project/symfony/phpstan.neon.dist.
[OK] No errors
CircleCI received exit code 0
Could this be related to https://github.com/phpstan/phpstan-src/pull/491 ? Ping @rrazor
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 4
- Comments: 35 (11 by maintainers)
Commits related to this issue
- Trying to reproduce #4881 — committed to phpstan/phpstan by ondrejmirtes 3 years ago
- Updated PHPStan to commit ce5f316febd8878fd122331b9c6b27778881e4a8 https://github.com/phpstan/phpstan-src/commit/18340a38e8199b0a3250289060c93bdabf2f4ab8 Address #4881 by implementing a more complete... — committed to phpstan/phpstan by ondrejmirtes 3 years ago
I tested that on several docker images like so:
Here are my results: ❌
spryker/php:7.3✔️php:7.3.27-alpine❌prooph/php:7.3-cli-opcache✔️prooph/php:7.4-cli-opcacheLooks like this is related to opcache, so I tried to create a few small images and test that again: ❌
alfredbez-local/php-7.2-alpine-opcache✔️php:7.2-alpine❌alfredbez-local/php-7.3-alpine-opcache✔️php:7.3-alpine✔️alfredbez-local/php-7.4-alpine-opcache✔️php:7.4-alpineHere’s how I build the images to test that:
The output of the phar provided by @rrazor looks like this:
@ondrejmirtes Ah, sorry, to summarize:
stream_eofwas not implemented; I implemented that and the warning went awayzend_mm_heap corruptedpanic in PHP versions 7.3 and earlier that surfaces when we attempt to allowrequireandrequire_oncevia the stream wrapper. Previously, the wrapper only supported autoloaders that usedincludeorinclude_once.The first issue was simple to resolve and the folks on this ticket have confirmed the PHP warnings went away with the
.pharI published.The second issue seems to be related to OpCache. The ways I’ve found that make the issue go away are either to disable OpCache for these PHP versions or to revert the previous work that supports
requireandrequire_once.Sounds like you are OK with dropping OpCache for older PHP versions, which is great.
I’ll submit a PR that fixes the
stream_eofwarning and solves thezend_mm_heap corruptedissue shortly.@rrazor thank you! Yes I can test with a custom cloned repo
@adrienfr I have not been able to reproduce this issue with the code provided on my own. If I provide a clone of the
phpstanrepo with a modified.pharwould you be willing to test it out in your environment, please? I suspect it’s either related to loading very large files or it is an issue only seen on specific architectures.