WordPress.org

Make WordPress Core

Opened 3 months ago

Closed 2 weeks ago

#40285 closed defect (bug) (invalid)

Themes in the Theme Directory should be required to use TGM-Plugin-Activation version of at least 2.6.1

Reported by: beeneeb Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.7.3
Component: Themes Keywords:
Focuses: Cc:

Description

The theme "Emmet Lite" located in the Wordpress Theme Directory uses version 2.5.2 of TGM-Plugin-Activation. Not only is it a security issue, but also causes fatal errors with other plugins that use the latest version of TGM of 2.6.1.

https://wordpress.org/themes/emmet-lite/

To reproduce, install the Emmet Lite theme & then install this plugin:

https://wordpress.org/plugins/our-team-enhanced/

Expected:

No fatal errors

Actual:

Fatal error: Cannot redeclare tgmpa() (previously declared

Change History (3)

#1 @jrf
3 months ago

Hi @beeneeb,

Just to clarify: this is not an issue with the TGMPA version being used, there is no conflict between TGMPA 2.4.1+ and higher versions.

This is a "typo" - or rather, search and replace error - made by the theme author who has manually adjusted the code in the TGMPA class.

Around line 1920, you will find a line that should read:
if ( ! function_exists( 'tgmpa' ) ) {

but will have been changed to read:
if ( ! function_exists( 'theme-slug' ) ) {

As they incorrectly changed it, the actual function which is wrapped within that if statement is being redefined causing that error.

Theme authors are advised to download a fresh copy of TGMPA whenever they release and/or upgrade a theme using the Custom TGMPA Generator. The Custom TGMPA Generator will serve them with a customized download of TGMPA which will automagically have done the search & replace for them in the correct way which prevents this issue.

#2 @jcastaneda
3 months ago

Hi @beeneeb!

What you can also do is comment on the theme's latest trac ticket and let them know about this issue or even posting on their support forum: https://wordpress.org/support/theme/emmet-lite

#3 @dd32
2 weeks ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

This should be reported to the theme author directly - @MotoPress
I don't see any threads in the themes forum though related to it.

The code in question that's faulty is https://themes.trac.wordpress.org/browser/emmet-lite/1.4.1/classes/theme/class-tgm-plugin-activation.php?marks=1917-1927#L1900

Marking as invalid as this isn't a core WordPress problem.

Note: See TracTickets for help on using tickets.