Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#52205 closed defect (bug) (fixed)

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

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

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 6 years ago.

Download all attachments as: .zip

Change History (6)

#1 @oakesjosh
6 years ago

  • Keywords has-patch added

#2 @johnbillion
6 years ago

  • Milestone 5.7 → 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
6 years ago

  • Owner set to TimothyBlynJacobs
  • Resolution → fixed
  • Status new → 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
6 years ago

  • Keywords fixed-major added
  • Resolution fixed
  • Status closed → reopened

Reopening for backport.

#5 @whyisjake
6 years ago

  • Resolution → fixed
  • Status reopened → 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.