WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#36709 closed defect (bug) (fixed)

Symlinked plugin path incorrectly registered during uninstall

Reported by: andy Owned by: ocean90
Milestone: 4.6 Priority: normal
Severity: normal Version: 3.9
Component: Plugins Keywords: has-patch
Focuses: administration Cc:
PR Number:

Description

The dirname() shouldn't be here in uninstall_plugin():

		wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . dirname( $file ) );

wp_register_plugin_realpath() calls dirname( $file ); to remove the basename. The basename must be included in the argument or the symlinked directory won't be registered. Then, if uninstall.php does this check it will fail:

if ( dirname( WP_UNINSTALL_PLUGIN ) != dirname( plugin_basename( __FILE__ ) ) )
  exit();

This was observed while trying to uninstall Jetpack which was installed as a symlink. The result was a WSOD. Removing the dirname() from uninstall_plugin() fixes the path registration and allows the check to pass.

Attachments (1)

36709.diff (545 bytes) - added by andy 4 years ago.

Download all attachments as: .zip

Change History (3)

@andy
4 years ago

#1 @ocean90
4 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 4.6
  • Version changed from trunk to 3.9

Introduced in [27158].

#2 @ocean90
4 years ago

  • Owner set to ocean90
  • Resolution set to fixed
  • Status changed from new to closed

In 37331:

Plugins: In uninstall_plugin() pass the plugin file to wp_register_plugin_realpath().

wp_register_plugin_realpath() calls dirname( $file ); to remove the basename. The basename must be included in the argument or the symlinked directory won't be registered.

Props andy.
Fixes #36709.

Note: See TracTickets for help on using tickets.