auto-patch 638-dev-dev01-2024-05-14T20_44_36

This commit is contained in:
root
2024-05-14 20:44:36 +00:00
parent a941559057
commit 5dbb0b284e
1812 changed files with 29671 additions and 14588 deletions

View File

@@ -95,14 +95,24 @@ class WC_Customer_Data_Store_Session extends WC_Data_Store_WP implements WC_Cust
* @param WC_Customer $customer The customer object.
*/
$allowed_keys = apply_filters( 'woocommerce_customer_allowed_session_meta_keys', array(), $customer );
$session_value = wp_json_encode(
array_filter(
$customer->get_meta_data(),
function( $meta_data ) use ( $allowed_keys ) {
return in_array( $meta_data->key, $allowed_keys, true );
}
$session_value = maybe_serialize(
array_map(
function ( $meta_data ) {
// Data comes to us a WC_Meta_Data, we cast it to an array to ensure it is serializable.
return array(
'key' => $meta_data->key,
'value' => $meta_data->value,
);
},
array_filter(
$customer->get_meta_data(),
function ( $meta_data ) use ( $allowed_keys ) {
return in_array( $meta_data->key, $allowed_keys, true );
}
)
)
);
} else {
$session_value = $customer->{"get_$function_key"}( 'edit' );
}
@@ -137,7 +147,7 @@ class WC_Customer_Data_Store_Session extends WC_Data_Store_WP implements WC_Cust
}
if ( ! empty( $data[ $session_key ] ) && is_callable( array( $customer, "set_{$function_key}" ) ) ) {
if ( 'meta_data' === $session_key ) {
$meta_data_values = json_decode( wp_unslash( $data[ $session_key ] ), true );
$meta_data_values = maybe_unserialize( $data[ $session_key ] );
if ( $meta_data_values ) {
foreach ( $meta_data_values as $meta_data_value ) {
if ( ! isset( $meta_data_value['key'], $meta_data_value['value'] ) ) {