Fix strict comparison for normal select, too.

This commit is contained in:
Peter Fabian 2018-04-13 10:26:37 +02:00
parent e17e6d0b0f
commit 0fc6d4e20c
1 changed files with 1 additions and 1 deletions

View File

@ -230,7 +230,7 @@ function woocommerce_wp_select( $field ) {
// The $key from $field['options'] could have been converted to integer automatically by PHP,
// thus the comparison needs to check both $key and (string) $key in case $field['value'] is an array
// with string values.
echo '<option value="' . esc_attr( $key ) . '" ' . selected( $field['value'] === $key || ( is_array( $field['value'] ) && ( in_array( $key, $field['value'], true ) || in_array( (string) $key, $field['value'], true ) ) ), true, false ) . '>' . esc_html( $value ) . '</option>';
echo '<option value="' . esc_attr( $key ) . '" ' . selected( $field['value'] === (string) $key || ( is_array( $field['value'] ) && ( in_array( $key, $field['value'], true ) || in_array( (string) $key, $field['value'], true ) ) ), true, false ) . '>' . esc_html( $value ) . '</option>';
}
?>
</select>