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

CRM-20849: Allow duplicate PSR-4 prefixes #10637

Merged
merged 1 commit into from
Jul 11, 2017
Merged

CRM-20849: Allow duplicate PSR-4 prefixes #10637

merged 1 commit into from
Jul 11, 2017

Conversation

mickadoo
Copy link
Contributor

@mickadoo mickadoo commented Jul 11, 2017

Overview

Currently when adding prefixes from an extension info.xml it uses the method setPsr4 which replaces and existing PSR-4 mapping with the same prefix.

We should allow multiple extensions to use the same namespace, particularly since the Civi\ namespace (which is used by core) is likely to be copied by extension authors.

Before

Two extensions using the same PSR-4 prefix will only allow classes from one to be autoloaded.

After

Multiple extensions can use the same PSR-4 prefix.


…g PSR-4 prefixes with the same name in the autoloader.
@colemanw
Copy link
Member

@totten can you please review this.

@colemanw
Copy link
Member

I just encountered a fatal error on a site with both api4 and civicase extensions running (unable to load a class in the \Civi namespace). Applying this patch fixed it :)

@totten
Copy link
Member

totten commented Jul 11, 2017

Thanks. Nicely reported.

  • From a design perspective, looks good.
  • From a testing perspective, I would'a basically done what Coleman just reported, so that seems good.

@totten totten merged commit ad16dd2 into civicrm:master Jul 11, 2017
@mickadoo mickadoo deleted the CRM-20849-allow-duplicate-psr4-prefix branch July 25, 2017 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants