[wp-trac] [WordPress Trac] #45880: Twenty Seventeen shows warning: file_get_contents when new post/page creation in Japanese Settings

WordPress Trac noreply at wordpress.org
Thu Jan 10 15:06:33 UTC 2019


#45880: Twenty Seventeen shows warning: file_get_contents when new post/page
creation in Japanese Settings
--------------------------+------------------------------
 Reporter:  atachibana    |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Themes        |     Version:  5.0.2
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by atachibana):

 The global variable `$editor_styles` in English settings has font
 information in 2nd element:

 {{{
 (
     [0] => assets/css/editor-style.css
     [1] =>
 https://fonts.googleapis.com/css?family=Libre+Franklin%3A300%2C300i%2C400%2C400i%2C600%2C600i%2C800%2C800i&subset=latin
 %2Clatin-ext
 )

 }}}

 But in Japanese environment no value.


 {{{
 (
     [0] => assets/css/editor-style.css
     [1] =>
 )

 }}}

 This blank value failed at `preg_match` and reached the error point in
 below sentences at wp-admin/edit-form-blocks.php line 200.


 {{{
 if ( $editor_styles && current_theme_supports( 'editor-styles' ) ) {
         foreach ( $editor_styles as $style ) {
                 if ( preg_match( '~^(https?:)?//~', $style ) ) {
                         $response = wp_remote_get( $style );
                         if ( ! is_wp_error( $response ) ) {
                                 $styles[] = array(
                                         'css' => wp_remote_retrieve_body(
 $response ),
                                 );
                         }
                 } else {
                         $file = get_theme_file_path( $style );
                         if ( file_exists( $file ) ) {
                                 $styles[] = array(
                                         'css'     => file_get_contents(
 $file ),
                                         'baseURL' => get_theme_file_uri(
 $style ),
                                 );
                         }
                 }
         }
 }

 }}}

 I'll investigate who set the global variable `$editor_styles` and why 2nd
 element is null only when Japanese Windows. It must be font settings
 issue...

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/45880#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list