WordPress.org

Make WordPress Core


Ignore:
Timestamp:
04/29/2020 04:06:55 PM (15 months 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.1 branch.

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

Location:
branches/5.1
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.1

  • branches/5.1/tests/phpunit/tests/formatting/SanitizeFileName.php

    r42343 r47646  
    6969        $this->assertEquals( 'no-extension', sanitize_file_name( '_.no-extension' ) );
    7070    }
     71
     72    /**
     73     * @dataProvider data_wp_filenames
     74     */
     75    function test_replaces_invalid_utf8_characters( $input, $expected ) {
     76        $this->assertEquals( $expected, sanitize_file_name( $input ) );
     77    }
     78
     79    function data_wp_filenames() {
     80        return array(
     81            array( urldecode( '%B1myfile.png' ), 'myfile.png' ),
     82            array( urldecode( '%B1myfile' ), 'myfile' ),
     83            array( 'demo bar.png', 'demo-bar.png' ),
     84            array( 'demo' . json_decode( '"\u00a0"' ) . 'bar.png', 'demo-bar.png' ),
     85        );
     86    }
    7187}
Note: See TracChangeset for help on using the changeset viewer.