Make WordPress Core


Ignore:
Timestamp:
04/29/2020 04:48:42 PM (4 years ago)
Author:
whyisjake
Message:

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 [47634], [47635], [47637], and [47638] to the 4.3 branch.

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

Location:
branches/4.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.3

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

    r37814 r47656  
    6161        $this->assertEquals( 'no-extension', sanitize_file_name( '_.no-extension' ) );
    6262    }
     63
     64    /**
     65     * @dataProvider data_wp_filenames
     66     */
     67    function test_replaces_invalid_utf8_characters( $input, $expected ) {
     68        $this->assertEquals( $expected, sanitize_file_name( $input ) );
     69    }
     70
     71    function data_wp_filenames() {
     72        return array(
     73            array( urldecode( '%B1myfile.png' ), 'myfile.png' ),
     74            array( urldecode( '%B1myfile' ), 'myfile' ),
     75            array( 'demo bar.png', 'demo-bar.png' ),
     76            array( 'demo' . json_decode( '"\u00a0"' ) . 'bar.png', 'demo-bar.png' ),
     77        );
     78    }
    6379}
Note: See TracChangeset for help on using the changeset viewer.