WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#21954 closed defect (bug) (duplicate)

Nested plugins cause activation link error

Reported by: prometh Owned by:
Milestone: Priority: normal
Severity: major Version: 3.4.2
Component: Upgrade/Install Keywords:
Focuses: Cc:

Description

My plugin, WP-HTML-Compression includes another of my plugins, Absolute-to-Relative-URLs from /wp-content/plugins/wp-html-compression/external/ after first checking if it already exists.

The problem is that nested plugin has a WordPress header which leads to the activation link being:

/wp-admin/plugins.php?action=activate&plugin=wp-html-compression%2Fexternal%2Fabsolute-to-relative-urls.php&_wpnonce=...

and results in a "The plugin does not have a valid header" error.

A temporary solution is to remove the header from the nested plugin.

Change History (3)

comment:1 @dd322 years ago

For reference (in case the plugin gets updated) the version which can trigger this is 0.5.2

From memory, the upgrader simply assumes that there'll only be one plugin in a directory (which is the expected behaviour).

The reason it picks up the 2nd plugin in this case is due to the function being used to find the plugins, It uses the same function as the main plugin page uses (which has to find files in subdirectories), in the root directory of the plugin, so the main plugin file is in . but it will also search in ./plugin-sub-directory/ for plugins (which doesn't happen on the plugins page) - I hope that's somewhat understandable..

Solution here is to either

  1. Not look in subdirectories in plugin installer/upgrader contexts
  2. Sort the plugins before pulling the first one out, ensures that the plugin we use for the links is in the root plugin directory.

comment:2 @prometh2 years ago

This issue also applies when deleting the plugin as it lists both plugins for deletion.

Version 0, edited 2 years ago by prometh (next)

comment:3 @SergeyBiryukov2 years ago

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

#22287 has a patch.

Note: See TracTickets for help on using tickets.