Make WordPress Core


Ignore:
Timestamp:
04/29/2020 04:04:20 PM (7 years ago)
Author:
whyisjake
Message:

Customize: Add additional filters to Customizer to prevent JSON corruption.
User: Invalidate user_activation_key on password update.
Query: Ensure that only a single post can be returned on date/time based queries.
Block Editor: Coding standards, properly escape class names.
Cache API: Ensure proper escaping around the stats method in the cache API.
Formatting: Expand sanitize_file_name to have better support for utf8 characters.

Brings the changes in [47633], [47634], [47635], [47636], [47637], and [47638] to the 5.4 branch.

Props: aduth, batmoo, ehti, ellatrix, jorgefilipecosta, nickdaugherty, noisysocks, pento, peterwilsoncc, sergeybiryukov, sstoqnov, talldanwp, westi, westonruter, whyisjake, whyisjake, xknown.

Location:
branches/5.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.3

  • branches/5.3/src/wp-includes/formatting.php

    r46900 r47644  
    20042004        $filename_raw  = $filename;
    20052005        $special_chars = array( '?', '[', ']', '/', '\\', '=', '<', '>', ':', ';', ',', "'", '"', '&', '$', '#', '*', '(', ')', '|', '~', '`', '!', '{', '}', '%', '+', chr( 0 ) );
     2006
     2007        // Check for support for utf8 in the installed PCRE library once and store the result in a static.
     2008        static $utf8_pcre = null;
     2009        if ( ! isset( $utf8_pcre ) ) {
     2010                // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
     2011                $utf8_pcre = @preg_match( '/^./u', 'a' );
     2012        }
     2013
     2014        if ( ! seems_utf8( $filename ) ) {
     2015                $_ext     = pathinfo( $filename, PATHINFO_EXTENSION );
     2016                $_name    = pathinfo( $filename, PATHINFO_FILENAME );
     2017                $filename = sanitize_title_with_dashes( $_name ) . '.' . $_ext;
     2018        }
     2019
     2020        if ( $utf8_pcre ) {
     2021                $filename = preg_replace( "#\x{00a0}#siu", ' ', $filename );
     2022        }
     2023
    20062024        /**
    20072025         * Filters the list of characters to remove from a filename.
    … …  
    20132031         */
    20142032        $special_chars = apply_filters( 'sanitize_file_name_chars', $special_chars, $filename_raw );
    2015         $filename      = preg_replace( "#\x{00a0}#siu", ' ', $filename );
    20162033        $filename      = str_replace( $special_chars, '', $filename );
    20172034        $filename      = str_replace( array( '%20', '+' ), '-', $filename );
Note: See TracChangeset for help on using the changeset viewer.