Open boutzamat opened 5 years ago
I tried to reproduce the issue by using versions 4.4 and 4.7 of the updater on the same site, but I didn't get get the fatal error that you got. It might depend on the version(s) or the plugin/theme configuration.
Puc_xyz_Factory
does the code use?Puc/v4p4/Vcs/ThemeUpdateChecker.php
?I experience the same issue with two plugins which are using to different versions of the plugin update checker (4.6 and 4.7). Both plugins are using composer with autoloading. One plugin uses
$this->update_server = Puc_v4_Factory::buildUpdateChecker(
$this->get_update_server_url(),
...
)
which works fine (I guess this plugin get's loaded first).
The second plugin uses a self hosted private gitlab project
$updateChecker = new Puc_v4p7_Vcs_PluginUpdateChecker(
new Puc_v4p7_Vcs_GitLabApi("..."),
...
)
but fails with the error
Fatal error: Uncaught Error: Class 'Puc_v4p7_Vcs_PluginUpdateChecker' not found
Any updates?
It took me a while to reproduce the issue and figure out what's causing the error. It has to do with how Composer generates autoloaders for packages that use the files
autoloading mechanism. It looks like Composer maintains a global list of files it has already loaded to ensure each file is loaded only once, and the file IDs are the same for different versions of the same package. This means that if you have two versions of a package, the Composer autoloader will only ever require()
the files from one of them - even if the versions are different.
I don't have an immediate solution. Bypassing Composer and including plugin-update-checker.php
could be an effective workaround for individual users, but it doesn't fix the larger problem. Switching to a PSR-0 style autoloader could be an option, but it would complicate Puc_v4_Factory
initialisation and might require special-case code just for Composer users.
Thanks for the update. I hope there's a solution within short time. And thank you for this awesome code.
I switched to using the psr-0
autoloading mechanism and that seems to have fixed the problem, at least in my own tests. Could you try the current master
branch and let me know if it works for you?
Edit: The version number has been increased to 4.8 (v4p8
).
Absolutely. Will try it out today or tomorrow at last
lør. 28. sep. 2019 14.56 skrev Yahnis Elsts notifications@github.com:
I switched to using the psr-0 autoloading mechanism and that seems to have fixed the problem, at least in my own tests. Could you try the current master branch and let me know if it works for you?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/YahnisElsts/plugin-update-checker/issues/300?email_source=notifications&email_token=ABA3BFQNIK63NCL7PTQAAXDQL5H63A5CNFSM4IFSEY6KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD72ZF7Y#issuecomment-536187647, or mute the thread https://github.com/notifications/unsubscribe-auth/ABA3BFWVHQU2W6BH6ZJTD43QL5H63ANCNFSM4IFSEY6A .
Have you had a chance to test it yet?
I tested v4.7.1-beta2
as well as the current master
branch and both seem to work. There are no errors upon the plugin activation and the plugin check. Thank you for the fix 👍 .
I am using this updater for my theme. I recently installed a plugin on a site that uses my theme, and that plugin uses this updater too.
When the plugin is activated, i get this error: `[21-Jul-2019 12:33:01 UTC] PHP Fatal error: Uncaught Error: Class 'Puc_v4p4_Vcs_ThemeUpdateChecker' not found in /home/carrotsundk/public_html/wp-content/plugins/email-customizer-for-woocommerce-with-drag-drop-builder/includes/updater/Puc/v4p4/Factory.php:99 Stack trace:
0 /home/carrotsundk/public_html/wp-content/themes/wp-bootstrap/functions.php(38): Puc_v4p4_Factory::buildUpdateChecker('https://github....', '/home/carrotsun...', 'wp-bootstrap')
1 /home/carrotsundk/public_html/wp-settings.php(499): include('/home/carrotsun...')
2 /home/carrotsundk/public_html/wp-config.php(89): require_once('/home/carrotsun...')
3 /home/carrotsundk/public_html/wp-load.php(37): require_once('/home/carrotsun...')
4 /home/carrotsundk/public_html/wp-blog-header.php(13): require_once('/home/carrotsun...')
5 /home/carrotsundk/public_html/index.php(17): require('/home/carrotsun...')
6 {main}
thrown in /home/carrotsundk/public_html/wp-content/plugins/email-customizer-for-woocommerce-with-drag-drop-builder/includes/updater/Puc/v4p4/Factory.php on line 99`
When i comment out the code that loads the updater in my theme, or disable the plugin that also uses the uploader, the error is gone.