Skip to content

Commit

Permalink
Merge pull request #21074 from woocommerce/fix/21026
Browse files Browse the repository at this point in the history
Fixes two product attributes issues when non-ASCII characters are used in the attribute name
  • Loading branch information
claudiulodro committed Aug 16, 2018
2 parents f1c6f3c + 4d2530e commit 6eea244
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions includes/abstracts/abstract-wc-product.php
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@ public function set_backorders( $backorders ) {
/**
* Set low stock amount.
*
* @param int|string $amount Empty string if value not set
* @param int|string $amount Empty string if value not set.
* @since 3.5.0
*/
public function set_low_stock_amount( $amount ) {
Expand Down Expand Up @@ -1104,7 +1104,7 @@ public function set_attributes( $raw_attributes ) {
$attributes = array_fill_keys( array_keys( $this->get_attributes( 'edit' ) ), null );
foreach ( $raw_attributes as $attribute ) {
if ( is_a( $attribute, 'WC_Product_Attribute' ) ) {
$attributes[ sanitize_title( $attribute->get_name() ) ] = $attribute;
$attributes[ sanitize_text_field( $attribute->get_name() ) ] = $attribute;
}
}

Expand Down
2 changes: 1 addition & 1 deletion includes/widgets/class-wc-widget-layered-nav.php
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ protected function layered_nav_list( $terms, $taxonomy, $query_type ) {
continue;
}

$filter_name = 'filter_' . sanitize_title( str_replace( 'pa_', '', $taxonomy ) );
$filter_name = 'filter_' . str_replace( 'pa_', '', $taxonomy );
$current_filter = isset( $_GET[ $filter_name ] ) ? explode( ',', wc_clean( wp_unslash( $_GET[ $filter_name ] ) ) ) : array(); // WPCS: input var ok, CSRF ok.
$current_filter = array_map( 'sanitize_title', $current_filter );

Expand Down

0 comments on commit 6eea244

Please sign in to comment.