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

Remove composer autoloading #471

Closed
rrennick opened this issue Feb 20, 2020 · 0 comments · Fixed by #472
Closed

Remove composer autoloading #471

rrennick opened this issue Feb 20, 2020 · 0 comments · Fixed by #472
Milestone

Comments

@rrennick
Copy link
Contributor

After an initial report in #463, testing for #464 and a followup PR #468, I've concluded that composer autoloading needs to be completely removed from AS.

From #464:

So, I suggest to remove "classmap" and add "files":

"autoload": {
    "files": ["action-scheduler.php"]
},

If you have two plugin active that are both configured to autoload a file named example.php only the example.php in the plugin that has its autoloader registered first will be autoloaded. Composer does not compare the files to determine whether they contain the same code. Instead, it assumes the files are duplicates.

Current AS configuration:

  "autoload": {
    "classmap": [
      "classes/",
      "deprecated/",
      "lib/"
    ]

If all plugins using AS updated to this configuration via composer then AS would not get initialized. The autoloader in the containing plugins would already have a class map for all the AS classes and the class_exists( 'ActionScheduler_Versions' ) check returns true

Code change in #468:

While this PR does correct the issue of initializing AS, the classmap(s) used are in the order that the plugin autoloaders are registered (thereby breaking the latest version logic). Since the functions.php isn't autoloaded, the functions.php used is from the latest registered version.

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 a pull request may close this issue.

1 participant