[wp-trac] [WordPress Trac] #42810: Updating metadata via the REST API fails when sanitized values match existing values

WordPress Trac noreply at wordpress.org
Wed Dec 6 07:22:47 UTC 2017


#42810: Updating metadata via the REST API fails when sanitized values match
existing values
--------------------------+-----------------------------
 Reporter:  bradyvercher  |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  REST API      |    Version:  4.7
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 `WP_REST_Meta_Fields::update_meta_value()` checks incoming values to make
 sure they don't match the existing value, otherwise `update_metadata()`
 will return `false` to prevent extra SQL queries.

 However, the check in `update_metadata()`
 [https://core.trac.wordpress.org/browser/trunk/src/wp-
 includes/meta.php#L176 sanitizes values before] doing the comparison,
 while the [https://core.trac.wordpress.org/browser/trunk/src/wp-includes
 /rest-api/fields/class-wp-rest-meta-fields.php#L310 method in the REST
 controller] does not, which causes the API request to fail when a meta
 sanitization callback alters the incoming value and causes it to match the
 existing value.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42810>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list