[wp-trac] [WordPress Trac] #49979: file_get_contents(): read of 8192 bytes failed with errno=21 Is a directory in /wp-includes/l10n.php on line 1096

WordPress Trac noreply at wordpress.org
Thu Apr 23 04:59:56 UTC 2020


#49979: file_get_contents(): read of 8192 bytes failed with errno=21 Is a directory
in /wp-includes/l10n.php on line 1096
--------------------------+-------------------------------------------
 Reporter:  Lwangaman     |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  I18N          |    Version:  5.4
 Severity:  normal        |   Keywords:  reporter-feedback needs-patch
  Focuses:                |
--------------------------+-------------------------------------------
 Using PHP 7.4.5 I have started getting this error when editing pages in
 the admin area. Seems like "." and ".." are now being read along with the
 files in a directory perhaps.

 For now I have patched my l10n.php with a further check if $file is a
 directory:

 {{{#!php
 <?php
         /**
          * Filters the file path for loading script translations for the
 given script handle and text domain.
          *
          * @since 5.0.2
          *
          * @param string|false $file   Path to the translation file to
 load. False if there isn't one.
          * @param string       $handle Name of the script to register a
 translation domain to.
          * @param string       $domain The text domain.
          */
         $file = apply_filters( 'load_script_translation_file', $file,
 $handle, $domain );

         if ( ! $file || ! is_readable( $file ) || is_dir($file) ) {
                 return false;
         }

         $translations = file_get_contents( $file );

 }}}

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


More information about the wp-trac mailing list