[wp-trac] [WordPress Trac] #45739: Block Editor: $editor_styles bug.

WordPress Trac noreply at wordpress.org
Sat Dec 22 05:06:52 UTC 2018


#45739: Block Editor: $editor_styles bug.
--------------------------+-----------------------------
 Reporter:  gqevu6bsiz    |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  5.0.2
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 WP 5.0.2 with TwentySeventeen, it is PHP Warning error on Post Edit/Add
 New Post screen.
   PHP Warning:  file_get_contents(/wp-content/themes/twentyseventeen):
 failed to open stream: Permission denied in wp-admin/edit-form-blocks.php
 on line 200

 It seems to **editor_style** file is nothing. This problem looks like
 TwentySeventeen, but I think it would be better to empty check for all
 themes.

 And TwentyNinteen, activate to Classic Editor is not get same problem.

 Example To
 {{{
         foreach ( $editor_styles as $style ) {
 >>                if ( empty( $style ) ) {
 >>                    continue;
 >>                }
                 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 ),
                                 );
                         }
                 }
         }
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/45739>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list