Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#52205 closed defect (bug) (fixed)

REST API: Plugins Controller single plugin route fatal errors on multisite

Reported by: timothyblynjacobs's profile TimothyBlynJacobs Owned by: timothyblynjacobs's profile TimothyBlynJacobs
Milestone: 5.6.1 Priority: normal
Severity: normal Version: 5.5
Component: REST API Keywords: good-first-bug has-patch fixed-major
Focuses: rest-api Cc:

Description

On multisite, trying to GET the single plugin endpoint, for example wp/v2/plugins/hello, fatal errors because is_network_only_plugin is not defined. This also effects the delete endpoint.

Due to how the collection route and installation routes are structured, they don't run into this issue. To fix this, I think we should add require_once ABSPATH . 'wp-admin/includes/plugin.php'; to the top of check_read_permission to make sure all our bases are covered.

Attachments (1)

52205.diff (785 bytes) - added by oakesjosh 4 years ago.

Download all attachments as: .zip

Change History (6)

@oakesjosh
4 years ago

#1 @oakesjosh
4 years ago

  • Keywords has-patch added

#2 @johnbillion
4 years ago

  • Milestone changed from 5.7 to 5.6.1

This wasn't introduced in 5.6 but it's a good candidate for a patch release. Moving to 5.6.1.

Thanks for the patch @oakesjosh .

#3 @TimothyBlynJacobs
4 years ago

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

In 49952:

REST API: Fix fatal error on multisite when calling the single item plugin routes.

The is_network_only_plugin and is_plugin_active functions are not available in a front-end context and must be specifically loaded.

Props oakesjosh.
Fixes #52205.

#4 @TimothyBlynJacobs
4 years ago

  • Keywords fixed-major added
  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening for backport.

#5 @whyisjake
4 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 50046:

REST API: Fix fatal error on multisite when calling the single item plugin routes.

The is_network_only_plugin and is_plugin_active functions are not available in a front-end context and must be specifically loaded.

This commit brings the changes from [49952] to the 5.6 branch.

Props oakesjosh, johnbillion, TimothyBlynJacobs.

Fixes #52205.

Note: See TracTickets for help on using tickets.