Make WordPress Core


Ignore:
Timestamp:
04/29/2020 04:15:39 PM (21 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.
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], [47637], and [47638] to the 4.9 branch.

Props: batmoo, ehti, nickdaugherty, peterwilsoncc, sergeybiryukov, sstoqnov, westi, westonruter, whyisjake, whyisjake, xknown.

Location:
branches/4.9
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.9

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

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