WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#35277 closed defect (bug) (duplicate)

Install/Activate issue: The plugin does not have a valid header.

Reported by: wpweaver Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.4
Component: Plugins Keywords: reporter-feedback
Focuses: Cc:
PR Number:

Description

This may be a duplicate, but I could not find any fixed or invalid resolutions.

Why does the code in the plugin installer KEEP looking for a new plugin header sequence after is has found a valid on in the plugin's root (e.g., the "Plugin Name:" and associated entries), while the Activate action from the Installed Plugins page does not?

This report is triggered by the latest version of TGM Plugin Activation (2.5.2), a fairly widely used plugin accessory library. For whatever reason, TGMPA added a valid looking plugin header into its library file which my plugin included in a sub-directory.

The INSTALL PLUGIN / Activate sequence gives priority to the TGMPA buried in a sub-directory entry, and thus issues the The plugin does not have a valid header. message. (Line 938 of /wp-admin/includes/plugin.php. The $plugin parameter has the "wrong" name at this point.)

On the other hand, the Activate action from the Installed Plugins page seems to use a DIFFERENT algorithm to get the plugin name, and will properly activate the plugin.

It would seem to me that the logic of the Install / Activate and Installed Plugins / Activate commands should be identical and consistent. It does seem the Installed Plugins / Activate response is correct, while the Install / Activate improperly gives priority to plugin headers in sub-directories.

Change History (2)

#1 @swissspidy
4 years ago

  • Keywords reporter-feedback added

Why does the code in the plugin installer KEEP looking for a new plugin header sequence after is has found a valid on in the plugin's root?
On the other hand, the Activate action from the Installed Plugins page seems to use a DIFFERENT algorithm to get the plugin name, and will properly activate the plugin.

Although it isn't really a best practice and not allowed in the plugin directory, multiple plugin files can be bundled in a single directory. For example, foo/bar.php and foo/baz.php can both contain valid plugin headers and can therefore be activated separately.

This report is triggered by the latest version of TGM Plugin Activation (2.5.2), a fairly widely used plugin accessory library. For whatever reason, TGMPA added a valid looking plugin header into its library file which my plugin included in a sub-directory.

TGMPA has had this plugin header for a long time.

Per https://wordpress.org/support/topic/the-plugin-does-not-have-a-valid-header-99, you were experiencing this with version 1.3.3 of your Show Sliders plugin. Correct?

I just uploaded this version on a local install and didn't experience any issues. Are there any specific steps needed to reproduce?

#2 @dd32
4 years ago

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

Duplicate of #22287, See also #21954

Note: See TracTickets for help on using tickets.