WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/09/2019 05:34:20 PM (2 years ago)
Author:
kadamwhite
Message:

REST API: Do not addslash when receiving meta arrays of non-string values.

Slashing non-string data caused PUT requests containing unmodified meta arrays of integers to fail the check against the existing stored meta value, causing a 500 when posting an unmodified response body back to the server.

Props TimothyBlynJacobs, augustuswm.
Fixes #48264.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/fields/class-wp-rest-meta-fields.php

    r46346 r46454  
    366366        }
    367367
    368         if ( ! update_metadata( $meta_type, $object_id, wp_slash( $meta_key ), wp_slash( $value ) ) ) {
     368        if ( ! update_metadata( $meta_type, $object_id, wp_slash( $meta_key ), wp_slash_strings_only( $value ) ) ) {
    369369            return new WP_Error(
    370370                'rest_meta_database_error',
Note: See TracChangeset for help on using the changeset viewer.