From 1370d8b86978259a9ec76b091c13d2bb3994fc9a Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Thu, 11 Feb 2016 17:35:28 +0000 Subject: [PATCH] Don't double-unslash meta key when `update_metadata()` falls back on `add_metadata()`. Props jdgrimes. Fixes #35795. Built from https://develop.svn.wordpress.org/trunk@36509 git-svn-id: http://core.svn.wordpress.org/trunk@36476 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/meta.php | 3 ++- wp-includes/version.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/wp-includes/meta.php b/wp-includes/meta.php index 19ce664da8..a3cbed0b99 100644 --- a/wp-includes/meta.php +++ b/wp-includes/meta.php @@ -161,6 +161,7 @@ function update_metadata($meta_type, $object_id, $meta_key, $meta_value, $prev_v $id_column = 'user' == $meta_type ? 'umeta_id' : 'meta_id'; // expected_slashed ($meta_key) + $raw_meta_key = $meta_key; $meta_key = wp_unslash($meta_key); $passed_value = $meta_value; $meta_value = wp_unslash($meta_value); @@ -198,7 +199,7 @@ function update_metadata($meta_type, $object_id, $meta_key, $meta_value, $prev_v $meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT $id_column FROM $table WHERE meta_key = %s AND $column = %d", $meta_key, $object_id ) ); if ( empty( $meta_ids ) ) { - return add_metadata($meta_type, $object_id, $meta_key, $passed_value); + return add_metadata( $meta_type, $object_id, $raw_meta_key, $passed_value ); } $_meta_value = $meta_value; diff --git a/wp-includes/version.php b/wp-includes/version.php index ae0e6068fd..92ed2fd520 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.5-alpha-36508'; +$wp_version = '4.5-alpha-36509'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.