From 3bfd2bab48dc1fe08d8980543d1f474dc05f7dce Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Thu, 29 Jun 2017 22:41:11 +0100 Subject: [PATCH] Prevent extra slashes on meta values by_mid functions do not expect slashes Fixes #15868 --- includes/data-stores/class-wc-data-store-wp.php | 2 +- includes/data-stores/class-wc-order-item-data-store.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/data-stores/class-wc-data-store-wp.php b/includes/data-stores/class-wc-data-store-wp.php index dca428463c0..5eb53a85891 100644 --- a/includes/data-stores/class-wc-data-store-wp.php +++ b/includes/data-stores/class-wc-data-store-wp.php @@ -111,7 +111,7 @@ class WC_Data_Store_WP { * @param stdClass (containing ->id, ->key and ->value) */ public function update_meta( &$object, $meta ) { - update_metadata_by_mid( $this->meta_type, $meta->id, wp_slash( $meta->value ), $meta->key ); + update_metadata_by_mid( $this->meta_type, $meta->id, $meta->value, $meta->key ); } /** diff --git a/includes/data-stores/class-wc-order-item-data-store.php b/includes/data-stores/class-wc-order-item-data-store.php index 36bbbaf647a..00d8b234846 100644 --- a/includes/data-stores/class-wc-order-item-data-store.php +++ b/includes/data-stores/class-wc-order-item-data-store.php @@ -75,7 +75,7 @@ class WC_Order_Item_Data_Store implements WC_Order_Item_Data_Store_Interface { * @return bool */ public function update_metadata( $item_id, $meta_key, $meta_value, $prev_value = '' ) { - return update_metadata( 'order_item', $item_id, $meta_key, $meta_value, $prev_value ); + return update_metadata( 'order_item', $item_id, $meta_key, wp_slash( $meta_value ), $prev_value ); } /** @@ -89,7 +89,7 @@ class WC_Order_Item_Data_Store implements WC_Order_Item_Data_Store_Interface { * @return int New row ID or 0 */ public function add_metadata( $item_id, $meta_key, $meta_value, $unique = false ) { - return add_metadata( 'order_item', $item_id, $meta_key, $meta_value, $unique ); + return add_metadata( 'order_item', $item_id, $meta_key, wp_slash( $meta_value ), $unique ); } /** @@ -103,7 +103,7 @@ class WC_Order_Item_Data_Store implements WC_Order_Item_Data_Store_Interface { * @return bool */ public function delete_metadata( $item_id, $meta_key, $meta_value = '', $delete_all = false ) { - return delete_metadata( 'order_item', $item_id, $meta_key, $meta_value, $delete_all ); + return delete_metadata( 'order_item', $item_id, $meta_key, wp_slash( $meta_value ), $delete_all ); } /**