TGMPA / TGM-Plugin-Activation

TGM Plugin Activation is a PHP library that allows you to easily require or recommend plugins for your WordPress themes (and plugins). It allows your users to install, update and even automatically activate plugins in singular or bulk fashion using native WordPress classes, functions and interfaces. You can reference bundled plugins, plugins from the WordPress Plugin Repository or even plugins hosted elsewhere on the internet.
http://tgmpluginactivation.com/
GNU General Public License v2.0
1.75k stars 431 forks source link

Fails on PHP 8.0 #803

Open BadScooter1980 opened 3 years ago

BadScooter1980 commented 3 years ago

Has anybody else noticed this gives a critical error on PHP 8.0?

It allows the first plugin to be installed (irregardless of if it is local or on a repository) and then gives a critical error.

Rolling back to PHP 7.4 it works just fine.

jrfnl commented 3 years ago

@BadScooter1980 Could you provide more information and a backtrace of the error you are receiving. TGMPA uses WP Core under the hood, so it will need to be determined whether this is an issue with WP Core or with TGMPA.

BadScooter1980 commented 3 years ago

@jrfnl Thanks for your reply. I'm not really sure what is causing this but have just setup another test on PHP 8.0 and upon attempting to install recommended plugins, I get the following message;

`Install Required Plugins The installation process is starting. This process may take a while on some hosts, so please be patient.

Installing Plugin Advanced Custom Fields PRO (1/5) There has been a critical error on this website. Please check your site admin email inbox for instructions.

Learn more about troubleshooting WordPress.`

It seems to always install the first one, but fails thereafter. No email is being sent either.

Works fine on 7.4 and below.

BadScooter1980 commented 3 years ago

Turning on debug gives me the following;

Fatal error: Uncaught ArgumentCountError: 3 arguments are required, 2 given in /home/sites/13b/8/815fb5c231/public_html/wp-admin/includes/class-bulk-upgrader-skin.php:152 Stack trace: #0 /home/sites/13b/8/815fb5c231/public_html/wp-admin/includes/class-bulk-upgrader-skin.php(152): sprintf('%1$s installed ...', 'Akismet Anti-Sp...') #1 /home/sites/13b/8/815fb5c231/public_html/wp-content/themes/core/inc/functions/class-tgm-plugin-activation.php(3646): Bulk_Upgrader_Skin->after('Akismet Anti-Sp...') #2 /home/sites/13b/8/815fb5c231/public_html/wp-admin/includes/class-wp-upgrader.php(823): TGMPA_Bulk_Installer_Skin->after() #3 /home/sites/13b/8/815fb5c231/public_html/wp-content/themes/core/inc/functions/class-tgm-plugin-activation.php(3266): WP_Upgrader->run(Array) #4 /home/sites/13b/8/815fb5c231/public_html/wp-content/themes/core/inc/functions/class-tgm-plugin-activation.php(3379): TGMPA_Bulk_Installer->run(Array) #5 /home/sites/13b/8/815fb5c231/public_html/wp-content/themes/core/inc/functions/class-tgm-plugin-activation.php(2985): TGMPA_Bulk_Installer->bulk_install(Array) #6 /home/sites/13b/8/815fb5c231/public_html/wp-content/themes/core/inc/functions/class-tgm-plugin-activation.php(751): TGMPA_List_Table->process_bulk_actions() #7 /home/sites/13b/8/815fb5c231/public_html/wp-includes/class-wp-hook.php(292): TGM_Plugin_Activation->install_plugins_page('') #8 /home/sites/13b/8/815fb5c231/public_html/wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters('', Array) #9 /home/sites/13b/8/815fb5c231/public_html/wp-includes/plugin.php(484): WP_Hook->do_action(Array) #10 /home/sites/13b/8/815fb5c231/public_html/wp-admin/admin.php(259): do_action('appearance_page...') #11 /home/sites/13b/8/815fb5c231/public_html/wp-admin/themes.php(10): require_once('/home/sites/13b...') #12 {main} thrown in /home/sites/13b/8/815fb5c231/public_html/wp-admin/includes/class-bulk-upgrader-skin.php on line 152

jrfnl commented 3 years ago

@BadScooter1980 Thank you for that additional info. That's helpful. Would you mind testing with the develop version of TGMPA to see if the issue still exists ? And if so, do you feel up to submitting a patch ?

BadScooter1980 commented 3 years ago

@jrfnl No problem. Sure, we can I find it?

CreativeDive commented 3 years ago

@jrfnl I can confirm, TGM is not working with PHP 8. I get the same error like @BadScooter1980

I think this is a critical error, because a lot of themes on Envato use TGM, because TGM is recommended by Envato to use it.

What will happen now?

@jrfnl Will there be an official release after a very long time?

CreativeDive commented 3 years ago

@jrfnl and @BadScooter1980 Good news. I have tested the "develop" version and it seems the install and activation process is working fine.

I have installed two plugins with TGM and it works like before.

@jrfnl But what that means for a new release of TGM?

TGM 2.6.1 is official recommended by Envato. But there will come more and more trouble in the future, if more users using PHP8.

BadScooter1980 commented 3 years ago

@jrfnl and @BadScooter1980 Good news. I have tested the "develop" version and it seems the install and activation process is working fine.

I have installed two plugins with TGM and it works like before.

@jrfnl But what that means for a new release of TGM?

TGM 2.6.1 is official recommended by Envato. But there will come more and more trouble in the future, if more users using PHP8.

Where can I get the developer version?

CreativeDive commented 3 years ago

@BadScooter1980 go to https://github.com/TGMPA/TGM-Plugin-Activation and click on the green button "Code" to download the develop version.

Make sure on the left side selection "develop" is selected.

BadScooter1980 commented 3 years ago

@CreativeDive Perfect! Got it, and works fine on 8. :)

asim59 commented 2 years ago

@CreativeDive I used it and it worked just fine. But when it comes to theme updates in WordPress, these issues are giving. http://prntscr.com/1qa53m4

CreativeDive commented 2 years ago

@asim59 I can't confirm this. Tested and it works fine.

jrfnl commented 2 years ago

@asim59 The error shown in your screenshot are not code errors, nor PHP warnings or anything. They are (incorrect) warnings from the ThemeCheck plugin. Please ask them to exclude TGMPA.

MiesSuomesta commented 1 year ago

Where the development version should be placed ?

ivandurst commented 1 year ago

I'm still getting this error, is this fixed?

ZebulanStanphill commented 1 year ago

@ivandurst It looks like the issue is only fixed in the development branch, and the stable release of the plugin has been neglected.

Also, it's worth noting that WordPress is currently working on adding a basic plugin dependencies system to core, and a feature plugin is available for testing right now. For simple use-cases, this may suffice as an alternative.

https://make.wordpress.org/core/2022/10/12/call-for-testing-plugin-dependencies/

EDIT: fixed typo, I meant to say the stable release of TGM Plugin Activation has been neglected.

CreativeDive commented 1 year ago

Yes, it seems this will be added to the core of WordPress in the near future. This could be a good and native alternative. https://make.wordpress.org/core/2022/10/12/call-for-testing-plugin-dependencies/

CreativeDive commented 1 year ago

It seems this https://make.wordpress.org/core/2022/10/12/call-for-testing-plugin-dependencies/ will support plugins that are available on wordpress.org only. Therefore currently this is no alternative way for me.

hellatan commented 1 year ago

Downloading and updating to the latest version of the class-tgm-plugin-activation.php file works. However, this file is misleading since the 2.6.1 version this one has is the same version number I have in the WP project i'm working on, which was created over a year ago. I just downloaded that version today. That should really be updated.

seliverstov-maxim commented 1 year ago

could you explain when will it be fixed?

hellatan commented 1 year ago

This was opened two years ago it looks like. If you go to their website and download the file from there, it will work for php 8. Not sure why it hasn't been updated here.

The main things I noticed were that it was a lot of comments/annotations that were changed. I didn't look too closely at all the changes though.

leadscloud commented 1 year ago

use latest /class-tgm-plugin-activation.php to solved.

php8 function sprintf will raise error when arguments not equal.