Merge pull request #23363 from woocommerce/fix/23361

Better iconv support handling in wc_ascii_uasort_comparison
This commit is contained in:
Mike Jolley 2019-04-18 14:27:46 +01:00 committed by GitHub
commit 9206d6f4dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -1623,9 +1623,9 @@ function wc_uasort_comparison( $a, $b ) {
* @return int
*/
function wc_ascii_uasort_comparison( $a, $b ) {
if ( function_exists( 'iconv' ) ) {
$a = iconv( 'UTF-8', 'ASCII//TRANSLIT', $a );
$b = iconv( 'UTF-8', 'ASCII//TRANSLIT', $b );
if ( function_exists( 'iconv' ) && defined( 'ICONV_IMPL' ) && @strcasecmp( ICONV_IMPL, 'unknown' ) !== 0 ) {
$a = @iconv( 'UTF-8', 'ASCII//TRANSLIT//IGNORE', $a );
$b = @iconv( 'UTF-8', 'ASCII//TRANSLIT//IGNORE', $b );
}
return strcmp( $a, $b );
}