Wp-rocket: PHP Notice: Missing permissions_callback triggered by doing_it_wrong in WP 5.5

Created on 11 Aug 2020  路  11Comments  路  Source: wp-media/wp-rocket

Before submitting an issue please check that you鈥檝e completed the following steps:

  • Made sure you鈥檙e on the latest version 馃憤
  • Used the search feature to ensure that the bug hasn鈥檛 been reported before 馃憤

Describe the bug
After updating to WP 5.5, whenever you open a page for edit or try to create a new post/page a PHP notice is displayed

Preconditions:

  1. WP Rocket is activated.
  2. Site is running WP 5.5

To Reproduce
Steps to reproduce the behavior:

  1. Go to the Admin dashboard and click "All pages"
  2. Click on "Add New" button

Expected behavior
The post editor is displayed.

Actual Behavior
The post editor is displayed, but a notice flash for a second, the error is also written to the debug log:
http://snippi.com/s/ekrsai6

Screenshots
image

Backlog Grooming (for WP Media dev team use only)

  • [x] Reproduce the problem
  • [x] Identify the root cause
  • [x] Scope a solution
  • [x] Estimate the effort
rocketcdn bug

Most helpful comment

Hey folks, we cherry picked and rolled this change into yesterday's 3.6.4 hotfix, so 馃 we won't be seeing any more of these.

We did, however, notice that WooCommerce 4.4.0 has the same issue, so customers may still report that they are getting the error.

In those cases, please check the notice itself if you get any new ones. If it's us, there will always be a line similar to line 10 in the above screenshot of an error stack trace with WP_Rocket\CDN\RocketCDN/RESTSubscriber->.

The WooCommerce 4.4.0 error will have a line like this one instead:

[18-Aug-2020 17:06:32 UTC] PHP  10. Automattic\WooCommerce\Blocks\RestApi::register_rest_routes() /Users/caspar/Local Sites/rocket/app/public/wp-includes/class-wp-hook.php:287

All 11 comments

鉁旓笍 Reproduced locally.
鉁旓笍 Root cause is lack of a permissions_callback item in our route registrations array is now triggering a doing_it_wrong notice as of WP 5.5
鉁旓笍 Solution:

  • [ ] Add the permissions_callback to the arrays in RESTSubscriber.php (These are public routes so we can use __return_true())
  • [ ] Update the integration tests that will fail without having the permissions_callback defined in the API tests' REST routes.

鉁旓笍 Estimated effort: [s]

Hey folks, we cherry picked and rolled this change into yesterday's 3.6.4 hotfix, so 馃 we won't be seeing any more of these.

We did, however, notice that WooCommerce 4.4.0 has the same issue, so customers may still report that they are getting the error.

In those cases, please check the notice itself if you get any new ones. If it's us, there will always be a line similar to line 10 in the above screenshot of an error stack trace with WP_Rocket\CDN\RocketCDN/RESTSubscriber->.

The WooCommerce 4.4.0 error will have a line like this one instead:

[18-Aug-2020 17:06:32 UTC] PHP  10. Automattic\WooCommerce\Blocks\RestApi::register_rest_routes() /Users/caspar/Local Sites/rocket/app/public/wp-includes/class-wp-hook.php:287
Was this page helpful?
0 / 5 - 0 ratings