Changeset 60411
- Timestamp:
- 07/05/2025 06:33:45 AM (5 months ago)
- Location:
- branches/6.8
- Files:
-
- 3 edited
- . (modified) (1 prop)
- src/wp-includes/formatting.php (modified) (1 diff)
- tests/phpunit/tests/formatting/sanitizeFileName.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/6.8
-
branches/6.8/src/wp-includes/formatting.php
r60317 r60411 2036 2036 2037 2037 if ( $utf8_pcre ) { 2038 $filename = preg_replace( "#\x{00a0}#siu", ' ', $filename ); 2038 /** 2039 * Replace all whitespace characters with a basic space (U+0020). 2040 * 2041 * The “Zs” in the pattern selects characters in the `Space_Separator` 2042 * category, which is what Unicode considers space characters. 2043 * 2044 * @see https://www.unicode.org/reports/tr44/#General_Category_Values 2045 * @see https://www.unicode.org/versions/Unicode16.0.0/core-spec/chapter-6/#G17548 2046 * @see https://www.php.net/manual/en/regexp.reference.unicode.php 2047 */ 2048 $filename = preg_replace( '#\p{Zs}#siu', ' ', $filename ); 2039 2049 } 2040 2050 -
branches/6.8/tests/phpunit/tests/formatting/sanitizeFileName.php
r55209 r60411 36 36 * 37 37 * @ticket 16330 38 * @ticket 62995 38 39 */ 39 40 public function test_replaces_spaces() { 40 41 $urls = array( 41 'unencoded space.png' => 'unencoded-space.png', 42 'encoded-space.jpg' => 'encoded-space.jpg', 43 'plus+space.jpg' => 'plusspace.jpg', 44 'multi %20 +space.png' => 'multi-20-space.png', 42 'unencoded space.png' => 'unencoded-space.png', 43 'encoded-space.jpg' => 'encoded-space.jpg', 44 'plus+space.jpg' => 'plusspace.jpg', 45 'multi %20 +space.png' => 'multi-20-space.png', 46 "Screenshot 2025-02-19 at 2.17.33\u{202F}PM.png" => 'Screenshot-2025-02-19-at-2.17.33-PM.png', 47 "Filename with non-breaking\u{00A0}space.txt" => 'Filename-with-non-breaking-space.txt', 48 "Filename with thin\u{2009}space.txt" => 'Filename-with-thin-space.txt', 45 49 ); 46 50
Note: See TracChangeset for help on using the changeset viewer.