Making WordPress.org

Changeset 4486


Ignore:
Timestamp:
12/06/2016 01:27:21 AM (8 years ago)
Author:
tellyworth
Message:

Plugin directory: handle invalid UTF8 when parsing and validating readme.

Fixes #2298

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/readme/class-parser.php

    r4386 r4486  
    143143    protected function parse_readme( $file ) {
    144144        $contents = file_get_contents( $file );
    145         $contents = preg_split( '!\R!u', $contents );
     145        if ( preg_match( '!!u', $contents ) )
     146            $contents = preg_split( '!\R!u', $contents );
     147        else
     148            $contents = preg_split( '!\R!', $contents ); // regex failed due to invalid UTF8 in $contents, see #2298
    146149        $contents = array_map( array( $this, 'strip_newlines' ), $contents );
    147150
Note: See TracChangeset for help on using the changeset viewer.