From 43addd9e1e8f030803254abbc2d5423faac117b8 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 11 Nov 2022 15:28:12 +0000 Subject: [PATCH] Formatting: Check that both `normalizer_*` functions exist in `remove_accents()`. This applies to: * `normalizer_is_normalized()` * `normalizer_normalize()` Includes removing the `Normalizer::FORM_C` constant as a parameter, since it is the default value for both functions and does not need to be explicitly passed. This avoids a fatal error if a plugin includes polyfill for any of the functions but the `Normalizer` class has a different namespace, for example when using the Symfony polyfill. Follow-up to [53754]. Props hellofromTonya, costdev, desrosj, mukesh27, zodiac1978, jchambo, gisgeo, SergeyBiryukov. Fixes #56980. Built from https://develop.svn.wordpress.org/trunk@54813 git-svn-id: http://core.svn.wordpress.org/trunk@54365 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/formatting.php | 8 +++++--- wp-includes/version.php | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index a8780b9c2a..1b70b762d6 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -1601,9 +1601,11 @@ function remove_accents( $string, $locale = '' ) { // Unicode sequence normalization from NFD (Normalization Form Decomposed) // to NFC (Normalization Form [Pre]Composed), the encoding used in this function. - if ( function_exists( 'normalizer_normalize' ) ) { - if ( ! normalizer_is_normalized( $string, Normalizer::FORM_C ) ) { - $string = normalizer_normalize( $string, Normalizer::FORM_C ); + if ( function_exists( 'normalizer_is_normalized' ) + && function_exists( 'normalizer_normalize' ) + ) { + if ( ! normalizer_is_normalized( $string ) ) { + $string = normalizer_normalize( $string ); } } diff --git a/wp-includes/version.php b/wp-includes/version.php index 2b0bd5e997..3bb0ae220e 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.2-alpha-54811'; +$wp_version = '6.2-alpha-54813'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.