Skip to content

Plugin: use recorded install paths when building the plugin runtime autoloader - #13250

Open
0xABCD01 wants to merge 2 commits into
composer:mainfrom
0xABCD01:fix/13248-plugin-autoloader-install-paths
Open

0xABCD01 wants to merge 2 commits into
composer:mainfrom
0xABCD01:fix/13248-plugin-autoloader-install-paths

Conversation

@0xABCD01

@0xABCD01 0xABCD01 commented Nov 9, 2026

Copy link
Copy Markdown

Fixes #13248

When a root package's dependencies are installed by a custom installer to a non-vendor/ location, the plugin runtime autoloader still records vendor/ paths for them. Plugin commands then warn about classmap files that cannot be found, e.g. Could not scan for classes inside ".../vendor/roundcube/carddav/carddav.php" for a package that actually lives under plugins/.

Root cause: PluginManager::registerPackage() resolves the dependency install paths before the plugin is activated, so a custom installer provided by that very plugin is not registered yet. The lookup falls back to LibraryInstaller, which always derives vendor/<name>. The main autoloader is not affected because it runs after plugin activation.

This change uses the path Composer already records at install time:

  • FilesystemRepository retains each package's recorded install-path from installed.json on load, with a new getInstallPath() that resolves it against the repository file's directory.
  • PluginManager::getInstallPath() prefers the recorded path (local and global repositories) and falls back to the previous derivation otherwise, so in-memory repositories, metapackages and mid-install registrations behave exactly as before.

Tests: a new PluginManagerTest regression test with custom-installer fixtures fails on current main with the reporter's exact warnings and passes with this change. I also reproduced the Roundcube-style setup end to end offline: the warnings appear on main and are gone with the fix. The full test suite shows the same failures before and after this change (pre-existing environment issues, e.g. missing ext-intl).

@Seldaek

Seldaek commented Nov 9, 2026

Copy link
Copy Markdown
Member

Thanks for the PR. However this introduces a bunch of edge cases that I am not super keen on having, so I'd rather first investigate the root cause (#13248 (comment)) before deciding on any further action.

@0xABCD01

Copy link
Copy Markdown
Author

Thanks for taking a look. Happy to leave this open while you dig into the initialization order — if you'd rather I close it until the root cause is clear, or rework it in a different direction once you know more, just say the word.

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.

Plugin runtime autoloader uses vendor/ paths for root dependencies installed by custom installers ("Could not scan for classes" warning)

2 participants