Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#50670 closed defect (bug) (fixed)

Upgrader implementation ignore UpgraderSkin interfaces

Reported by: schlessera's profile schlessera Owned by:
Milestone: 5.5 Priority: normal
Severity: normal Version: 5.5
Component: Plugins Keywords: reporter-feedback
Focuses: Cc:


The new Upgrader implementations like Plugin_Upgrader don't stick to the interfaces they claim to use in terms of the WP_Upgrader_Skin and just directly access properties like $overwrite that are only declared for _some_ implementations.

This is a violation of the open/closed principle and cause code that already extends the UpgraderSkin to break. An example of this can be found here:

The code should either first check whether the properties/methods that are not part of the interface are actually available or not, or it should only accept specific implementations, or an adapted interface.

Change History (3)

#1 @azaozz
3 years ago

  • Keywords needs-patch reporter-feedback added

Seems to happen only for themes. Caused by Theme_Upgrader missing a conditional that is in Plugin_Upgrader. See and

What would be the best fix here? Adding public $overwrite; to WP_Upgrader_Skin or the conditional, or both? :)

Last edited 3 years ago by azaozz (previous) (diff)

#2 @SergeyBiryukov
3 years ago

In 48493:

Upgrade/Install: Check if the theme installer skin's overwrite property exists in Theme_Upgrader::install_strings().

This ensures consistency with Plugin_Upgrader::install_strings() and resolves an issue caused by the property not existing in other upgrader implementations.

Props schlessera, azaozz.
See #50670.

#3 @SergeyBiryukov
3 years ago

  • Keywords needs-patch removed
  • Resolution set to fixed
  • Status changed from new to closed

I think this is fixed by [48493], feel free to reopen if any other changes are needed.

Note: See TracTickets for help on using tickets.