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

Add test for #7960 - custom autoloader is called twice #9232

Merged
merged 2 commits into from
Jun 7, 2023

Conversation

mvorisek
Copy link
Contributor

@mvorisek mvorisek commented Apr 23, 2023

add test for #7960

the problem is present when:

  • a class is autoloaded from phpstan
  • and the class has a parent class
  • and both classes are unloaded
  • and both classes are loaded using dynamic autoloader

in such scenario, phpstan tries to call the autoloader twice, which is wrong as it should never be called more than one for one name

CI: https://github.com/phpstan/phpstan/actions/runs/4784807550/jobs/8506769532?pr=9232#step:7:24

(when if (class_exists($name)) { return; } is added to the custom autoloader, phpstan does finish as expected without an error)

@mvorisek mvorisek changed the title Add test for #7960 Add test for #7960 - user autoloader is called twice Apr 25, 2023
@mvorisek mvorisek changed the title Add test for #7960 - user autoloader is called twice Add test for #7960 - custom autoloader is called twice Apr 26, 2023
@mvorisek
Copy link
Contributor Author

mvorisek commented Jun 7, 2023

@ondrejmirtes this repro/test sits here for a whole, would you be ok to look at it? Thank you.

@ondrejmirtes ondrejmirtes merged commit e84b04e into phpstan:1.10.x Jun 7, 2023
137 of 142 checks passed
@ondrejmirtes
Copy link
Member

Thank you.

@mvorisek mvorisek deleted the add_7960_test branch June 7, 2023 09:25
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.

None yet

2 participants