WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#38527 closed defect (bug) (fixed)

Send an error if the client tries to delete an option with an non-scalar

Reported by: rachelbaker Owned by: rachelbaker
Milestone: 4.7 Priority: normal
Severity: normal Version: 4.7
Component: REST API Keywords:
Focuses: Cc:

Description (last modified by rachelbaker)

API should error when attempting to update an option holding an invalid value

Related GH PR: https://github.com/WP-API/WP-API/pull/2851

Change History (2)

#1 @rachelbaker
3 years ago

  • Description modified (diff)

#2 @rachelbaker
3 years ago

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

In 38982:

REST API: Return WP_Error when a client is attempting to update an option with a non-scalar value to null.

A null value is returned in the response for any option that has a non-scalar value.

To protect clients from accidentally including the null values from a response object in a request, we do not allow options with non-scalar values to be updated to null. Without this added protection a client could mistakenly delete all options that have non-scalar values from the database.

Props joehoyle, rachelbaker.
Fixes #38527.

Note: See TracTickets for help on using tickets.