Skip to content

Bugfix: Autoloaders require source, not the file - #357

Merged
michielgerritsen merged 2 commits into
masterfrom
bugfix/autoloader-requires-generated-file-not-source
Sep 14, 2026
Merged

michielgerritsen merged 2 commits into
masterfrom
bugfix/autoloader-requires-generated-file-not-source

Conversation

@michielgerritsen

@michielgerritsen michielgerritsen commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

On PHPStan 2.2.10 with PHP 8.3+, every generated Factory, Proxy, Extension and ExtensionInterface class fails with Internal error: Failed opening required '<?php ...'. FileCacheStorage saved the generated source but returned a file path from load(), which a CacheStorage must not do, so once PHPStan started to serve cache entries from its shared memory arena, Cache::load() returned the source and the autoloaders required that in place of the file. GeneratedFileCache replaces it: putFile() returns the path it wrote, and the autoloaders no longer touch PHPStan\Cache\Cache.

bin/ci_autoloader_smoke guards it with a real analysis over a generated fixture (cold cache, parallel) that fails on any internal error. It probes the arena first, and with REQUIRE_TURBO=1 it refuses to pass when the arena is unusable. The guard fails on master and passes here.

Fixes #356

@Morgy93

Morgy93 commented Sep 1, 2026

Copy link
Copy Markdown

Interesting, I just ran into the same issue today, and there's already a PR for it from yesterday.
What a world we live in. Thanks for your effort!

I hope we can get this resolved and released soon.

Would love to help wherever I can 😊

@michielgerritsen
michielgerritsen force-pushed the bugfix/autoloader-requires-generated-file-not-source branch from 2417c71 to 7e34707 Compare September 2, 2026 09:32
@JosephLeedy

Copy link
Copy Markdown

Any updates on when this fix will be merged?

@michielgerritsen michielgerritsen added this to the 0.44.0 milestone Sep 14, 2026
@michielgerritsen
michielgerritsen merged commit 896d8bb into master Sep 14, 2026
3 checks passed
@michielgerritsen

Copy link
Copy Markdown
Contributor Author

@JosephLeedy It got just released as 0.44.0

@michielgerritsen
michielgerritsen deleted the bugfix/autoloader-requires-generated-file-not-source branch September 14, 2026 18:05
@JosephLeedy

Copy link
Copy Markdown

@JosephLeedy It got just released as 0.44.0

Thanks, @michielgerritsen!

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.

Internal error "Failed opening required '<?php ...'" with PHPStan 2.2.10 on PHP 8.3+

3 participants