-
-
Notifications
You must be signed in to change notification settings - Fork 918
FileReadTrapStreamWrapper::stream_eof is not implemented! since 0.12.84 #4881
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This bug report is missing a link to reproduction on phpstan.org. It will most likely be closed after manual review. |
Yeah, please @rrazor, could you look into this? Thanks! |
I will take a look ASAP, I agree it seems related to my recent PR. Thanks for the report!
|
@adrienfr I have not been able to reproduce this issue with the code provided on my own. If I provide a clone of the |
@rrazor thank you! Yes I can test with a custom cloned repo |
Ideally I'd love a reproduction submitted similar to this one: 2bef7e4#diff-6d8749c4fe00b757c1bc1c376a99f31d1bd38b422d44f5b6aa2d6a6c5e975cba |
Maybe some piece of code calls |
@ondrejmirtes That's my thought. I've been using this Ideally I'd like to repro this somehow using |
Yep, that might surface the bug :) Thank you really much, looks like you really know your stuff :) This might also be an opportunity at looking at the other un-implemented methods and trying to surface other, not yet reported bugs. |
OK @adrienfr, please take a look at my fork of the main PHPStan repository and test with the |
I ran into the same error, looks like this in our CI job:
I can try to run that with the |
Here is the output with the
Tell me if you need anything to help |
@alfredbez Thank you for the additional report, I know that custom autoloader from PHP CodeSniffer, so perhaps that will help me repro the issue. @adrienfr and @alfredbez, can you share any details about the build environment that may help me – OS, PHP version, Docker / not-Docker, etc.? It's very disconcerting to see a @ondrejmirtes If I can't track this down quickly it may be best to revert my PR and release a new version. |
I've had multiple problems with the PHP_CodeSniffer autoloader in the past (unrelated to this issue), you might be better off by not using it and just have PHP_CodeSniffer directory scanned with scanDirectories. |
I got the error in Gitlab CI with the docker-image |
I'm ont CircleCI with image |
Same here in Gitlab CI (php 7.2 cli) |
I tested that on several docker images like so:
Here are my results: Looks like this is related to opcache, so I tried to create a few small images and test that again: Here's how I build the images to test that: # 7.2-alpine-opcache/Dockerfile
FROM php:7.2-alpine
RUN docker-php-ext-configure opcache --enable-opcache && docker-php-ext-install opcache
COPY config/opcache.ini $PHP_INI_DIR/conf.d/ docker build -t alfredbez-local/php-7.2-alpine-opcache . # run this in the folder where the Dockerfile is # 7.3-alpine-opcache/Dockerfile
FROM php:7.3-alpine
RUN docker-php-ext-configure opcache --enable-opcache && docker-php-ext-install opcache
COPY config/opcache.ini $PHP_INI_DIR/conf.d/ docker build -t alfredbez-local/php-7.3-alpine-opcache . # 7.4-alpine-opcache/Dockerfile
FROM php:7.4-alpine
RUN docker-php-ext-configure opcache --enable-opcache && docker-php-ext-install opcache
COPY config/opcache.ini $PHP_INI_DIR/conf.d/ docker build -t alfredbez-local/php-7.4-alpine-opcache . The output of the phar provided by @rrazor looks like this:
|
If you can run this under gdb, set a breakpoint at |
Awesome work @alfredbez this helps me a ton! |
I've created a small repository to reproduce the issue here: https://github.com/alfredbez/phpstan-0-12-84-error/ You can see the error also in the Github Action here: https://github.com/alfredbez/phpstan-0-12-84-error/runs/2401281264?check_suite_focus=true#step:5:8 |
I'm seeing the weirdest behavior inside the
Yes, that's right, identical files, but PHP just silently loads the first one for me with no Exception... I'm putting this down to Docker filesystem mounting issues, but no wonder I have been having trouble reproducing the issue. |
Wow, opcache on 7.3 seems quite troublesome in CLI, but I found a way to repro in
|
Sorry everyone for the delay getting this resolved. After taking many passes at making the wrapper work in harmony with pre-7.4 OpCache, I think the simplest solution is for @ondrejmirtes is that an acceptable solution for you? |
@rrazor I'm sorry, could you summarize your thought process here? Is there any PHP version-specific bug that we're working around? I thought we're reproducing the problem when the I'm not a fan of turning off OPCache for everyone here because I was looking forward to taking advantage of PHP 8's JIT in the future. |
@ondrejmirtes It is a PHP version-specific issue with versions before 7.4 with OpCache enabled. I'm not sure based on the various stack traces and implementations I've tried if I'm running into an OpCache bug with 7.3.x and earlier or not, but it seems likely. It makes sense that you wouldn't want to disable OpCache. Another workaround could be to only support discovery of autoloaded files that use A third route would be to revert my entire previous PR rather than have PHP-version-specific conditionals inside the |
So there are two separate issues here? One that causes PHP to crash, and another one that asks the stream wrapper to have the
Isn't this reversed? We have a problem with the new approach on PHP 7.3 and lower. So the solution would be to only have Pragmatically, I think we could disable the OPCache on 7.3 and lower. It'd still be enabled for the JIT on PHP 8. Feel free to send a PR for |
@ondrejmirtes Ah, sorry, to summarize:
The first issue was simple to resolve and the folks on this ticket have confirmed the PHP warnings went away with the 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 Sounds like you are OK with dropping OpCache for older PHP versions, which is great. I'll submit a PR that fixes the |
Awesome! Would be nice to also have the stream_eof warning reproduced here in phpstan/phpstan in e2e directory similarly to how I reproduced the require issue for the previous release. Feel free to have a composer.json there that uses PHP_CodeSniffer somehow (if that's what leads to reproducing it). |
I tried and failed to find a way to reproduce the EOF warning with a simple test case. I think to do so you need to have an autoloader registered from within a PHAR, like when |
@rrazor since you have the steps at hand to repro the problem, would it be worth it to report the problem to php-src? |
Not sure if more info is needed but we’re seeing this in the drupal-graphql repo as well (which also uses CodeSniffer): https://github.com/drupal-graphql/graphql/pull/1194/checks?check_run_id=2410749566 |
Fixed by phpstan/phpstan-src#501, thanks everyone! |
phpstan/phpstan-src@18340a3 Address #4881 by implementing a more complete fake stream wrapper phpstan/phpstan-src@ce5f316 Disable OpCache for PHP < 7.4.x, #4881
Thank you @rrazor , @ondrejmirtes & @alfredbez! |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Bug report
Since upgrading phpstan/phpstan (0.12.83 => 0.12.84), I encounter this error on CircleCI :
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 :Expected output
Could this be related to phpstan/phpstan-src#491 ? Ping @rrazor
The text was updated successfully, but these errors were encountered: