Skip to content
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

Fix fatal error when autoloader open directories #2154

Merged
merged 1 commit into from
Dec 29, 2022

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Dec 29, 2022

before this fix running the reproducer in phpstan/phpstan#8611 resulted in

refs phpstan/phpstan#8610

$ php bin/phpstan analyze ../phpstan/e2e/bug8610/ -c ../phpstan/e2e/bug8610/phpstan.neon 
 3/3 [============================] 100%

 -- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
     Error
 -- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     Internal error: Internal error: RecursiveDirectoryIterator::__construct(C:\dvl\Workspace\phpstan\e2e\bug8610/classes): Failed to open directory:
     "PHPStan\Reflection\BetterReflection\SourceLocator\FileReadTrapStreamWrapper::dir_opendir" call failed in file C:\dvl\Workspace\phpstan\e2e\bug8610\trigger-autoload.php
     Run PHPStan with -v option and post the stack trace to:
     https://github.com/phpstan/phpstan/issues/new?template=Bug_report.md
     Child process error (exit code 1):
 -- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------


                                                                                                                        
 [ERROR] Found 2 errors                                                                                                                                                                                                                      

after this fix I get

$ php bin/phpstan analyze ../phpstan/e2e/bug8610/ -c ../phpstan/e2e/bug8610/phpstan.neon 
 3/3 [============================] 100%

 ------ --------------------------------------------------------------------- 
  Line   phpstan\e2e\bug8610\trigger-autoload.php                             
 ------ --------------------------------------------------------------------- 
  5      Instantiated class DoesNotExist not found.                           
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols  
 ------ --------------------------------------------------------------------- 


                                                                                                                        
 [ERROR] Found 1 error                                                                                                                                                                                                                         

since I am not able to reproduce the actual reported issue locally, thats more of a educated guess then a properly tested fix.

wdyt? or is it required to actually read the dir etc.?

@staabm staabm marked this pull request as ready for review December 29, 2022 15:07
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

@ondrejmirtes
Copy link
Member

Re-run the build and you'll see if it's green. You can for example amend the last commit to change its hash.

@staabm
Copy link
Contributor Author

staabm commented Dec 29, 2022

we are getting the expected error (an no longer a fatal internal errors). what is missing is, that this new error is considered a success :-)

@ondrejmirtes
Copy link
Member

Should be a baseline - ignored error matched -> success

@ondrejmirtes
Copy link
Member

Thank you. Please verify with phpstan/phpstan 1.9.x-dev that your issue is gone.

@staabm staabm deleted the bug8610 branch December 29, 2022 19:39
@staabm
Copy link
Contributor Author

staabm commented Dec 29, 2022

running on 1.9.x-dev finishes as expected. thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants