Merge pull request #21074 from woocommerce/fix/21026

Fixes two product attributes issues when non-ASCII characters are used in the attribute name
This commit is contained in:
Claudiu Lodromanean 2018-08-16 13:22:16 -07:00 committed by GitHub
commit 6eea244a28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -978,7 +978,7 @@ class WC_Product extends WC_Abstract_Legacy_Product {
/**
* 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 ) {
@ -1104,7 +1104,7 @@ class WC_Product extends WC_Abstract_Legacy_Product {
$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;
}
}

View File

@ -423,7 +423,7 @@ class WC_Widget_Layered_Nav extends WC_Widget {
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 );