Skip to content

Commit

Permalink
fix: ingore sanitizing value for product attributes (#594)
Browse files Browse the repository at this point in the history
  • Loading branch information
saimonh3 authored and sabbir1991 committed Apr 17, 2019
1 parent 4f22ff2 commit 859fd93
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions includes/wc-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ function dokan_process_product_meta( $post_id, $data = [] ) {
$attribute_values = array();

foreach ( $data['attribute_values'] as $values ) {
$attribute_values[] = array_map( 'sanitize_text_field', (array) $values );
$attribute_values[] = $values;
}

if ( isset( $data['attribute_visibility'] ) ) {
Expand Down Expand Up @@ -148,12 +148,12 @@ function dokan_process_product_meta( $post_id, $data = [] ) {

// Select based attributes - Format values (posted values are slugs)
if ( is_array( $attribute_values[ $i ] ) ) {
$values = array_map( 'wc_clean', $attribute_values[ $i ] );
$values = $attribute_values[ $i ]; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized

// Text based attributes - Posted values are term names, wp_set_object_terms wants ids or slugs.
} else {
$values = array();
$raw_values = array_map( 'wc_sanitize_term_text_based', explode( WC_DELIMITER, $attribute_values[ $i ] ) );
$raw_values = explode( WC_DELIMITER, $attribute_values[ $i ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized

foreach ( $raw_values as $value ) {
$term = get_term_by( 'name', $value, $attribute_names[ $i ] );
Expand Down

0 comments on commit 859fd93

Please sign in to comment.