Skip to content

fix: ambiguous bundle resolution in BundleLocator#18858

Merged
fashxp merged 1 commit intopimcore:11.5from
rberneder:11.5
Dec 1, 2025
Merged

fix: ambiguous bundle resolution in BundleLocator#18858
fashxp merged 1 commit intopimcore:11.5from
rberneder:11.5

Conversation

@rberneder
Copy link
Copy Markdown
Contributor

BundleLocator might resolve the wrong bundle name when names start identically.

E.g. if bundle \App\Bundle\MyBundle and \App\Bundle\MyOtherBundle coexist, BundleLocator currently matches both. This leads to the error that the first matching bundle will get resolved.

Adding a namespace delimiter at the end ensures uniqueness.

@github-actions
Copy link
Copy Markdown

Review Checklist

  • Target branch (11.5 for bug fixes, others 11.x)
  • Tests (if it's testable code, there should be a test for it - get help)
  • Docs (every functionality needs to be documented, see here)
  • Migration incl. install.sql (e.g. if the database schema changes, ...)
  • Upgrade notes (deprecations, important information, migration hints, ...)
  • Label
  • Milestone

@github-actions
Copy link
Copy Markdown

github-actions bot commented Nov 28, 2025

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@rberneder
Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@sonarqubecloud
Copy link
Copy Markdown

@fashxp
Copy link
Copy Markdown
Member

fashxp commented Dec 1, 2025

Thx very much for your contribution.

But, I'm not sure how \App\Bundle\MyBundle and \App\Bundle\MyOtherBundle could be distinguished by adding a bundle separator?

@rberneder
Copy link
Copy Markdown
Contributor Author

My bad, you're right in that case. But if we had \App\Bundle\CustomManagementBundle and \App\Bundle\CustomOrganizationBundle, we see that both namespaces start with \App\Bundle\Custom, thus both would match.

@jdreesen
Copy link
Copy Markdown
Contributor

jdreesen commented Dec 1, 2025

And how does a namespace separator help in this case?

@rberneder
Copy link
Copy Markdown
Contributor Author

Sorry, good point. Now I have the proper example:
We have

\App\Bundle\Branding\BrandingBundle // namespace: \App\Bundle\Branding
\App\Bundle\BrandingAdmin\BrandingAdminBundle // namespace: \App\Bundle\BrandingAdmin

If you then want to resolve: \App\Bundle\BrandingAdmin\Document\MyBrick using str_starts_with, both namespaces above would match.

@fashxp fashxp added the Bug label Dec 1, 2025
@fashxp fashxp added this to the 11.5.13 milestone Dec 1, 2025
@fashxp
Copy link
Copy Markdown
Member

fashxp commented Dec 1, 2025

thx for clarification.

@fashxp fashxp merged commit 9246a42 into pimcore:11.5 Dec 1, 2025
20 of 21 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Dec 1, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants