Make WordPress Core

Opened 2 weeks ago

Last modified 9 days ago

#52205 reopened defect (bug)

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

Reported by: TimothyBlynJacobs Owned by: 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:


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 10 days ago.

Download all attachments as: .zip

Change History (5)

10 days ago

#1 @oakesjosh
10 days ago

  • Keywords has-patch added

#2 @johnbillion
10 days 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
9 days 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
9 days ago

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

Reopening for backport.

Note: See TracTickets for help on using tickets.