diff options
Diffstat (limited to 'src/wp-includes/formatting.php')
-rw-r--r-- | src/wp-includes/formatting.php | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php index 744eefeb82..234d71a2a1 100644 --- a/src/wp-includes/formatting.php +++ b/src/wp-includes/formatting.php @@ -2035,7 +2035,17 @@ function sanitize_file_name( $filename ) { } if ( $utf8_pcre ) { - $filename = preg_replace( "#\x{00a0}#siu", ' ', $filename ); + /** + * Replace all whitespace characters with a basic space (U+0020). + * + * The “Zs” in the pattern selects characters in the `Space_Separator` + * category, which is what Unicode considers space characters. + * + * @see https://www.unicode.org/reports/tr44/#General_Category_Values + * @see https://www.unicode.org/versions/Unicode16.0.0/core-spec/chapter-6/#G17548 + * @see https://www.php.net/manual/en/regexp.reference.unicode.php + */ + $filename = preg_replace( '#\p{Zs}#siu', ' ', $filename ); } /** @@ -2551,6 +2561,11 @@ function balanceTags( $text, $force = false ) { // phpcs:ignore WordPress.Namin /** * Balances tags of string using a modified stack. * + * {@internal Modified by Scott Reilly (coffee2code) 02 Aug 2004 + * 1.1 Fixed handling of append/stack pop order of end text + * Added Cleaning Hooks + * 1.0 First Version} + * * @since 2.0.4 * @since 5.3.0 Improve accuracy and add support for custom element tags. * @@ -2559,10 +2574,6 @@ function balanceTags( $text, $force = false ) { // phpcs:ignore WordPress.Namin * @copyright November 4, 2001 * @version 1.1 * @todo Make better - change loop condition to $text in 1.2 - * @internal Modified by Scott Reilly (coffee2code) 02 Aug 2004 - * 1.1 Fixed handling of append/stack pop order of end text - * Added Cleaning Hooks - * 1.0 First Version * * @param string $text Text to be balanced. * @return string Balanced text. |