Make WordPress Core

Ticket #42838: dirname.diff

File dirname.diff, 2.1 KB (added by calin, 7 years ago)
  • wp-admin/includes/file.php

    diff --git a/wp-admin/includes/file.php b/wp-admin/includes/file.php
    index ced798288e..9234f76ddd 100644
    a b function _wp_handle_upload( &$file, $overrides, $time, $action ) { 
    861861        }
    862862
    863863        // Set correct file permissions.
    864         $stat = stat( dirname( $new_file ));
     864        $stat = stat( trailingslashit( dirname( $new_file ) ) );
    865865        $perms = $stat['mode'] & 0000666;
    866866        @ chmod( $new_file, $perms );
    867867
  • wp-includes/class-wp-image-editor-gd.php

    diff --git a/wp-includes/class-wp-image-editor-gd.php b/wp-includes/class-wp-image-editor-gd.php
    index c5050b21d3..2ed9002c30 100644
    a b class WP_Image_Editor_GD extends WP_Image_Editor { 
    404404                }
    405405
    406406                // Set correct file permissions
    407                 $stat = stat( dirname( $filename ) );
     407                $stat = stat( trailingslashit ( dirname( $filename ) ) );
    408408                $perms = $stat['mode'] & 0000666; //same permissions as parent folder, strip off the executable bits
    409409                @ chmod( $filename, $perms );
    410410
  • wp-includes/class-wp-image-editor-imagick.php

    diff --git a/wp-includes/class-wp-image-editor-imagick.php b/wp-includes/class-wp-image-editor-imagick.php
    index 9f6a0f3b52..a61ce2ee91 100644
    a b class WP_Image_Editor_Imagick extends WP_Image_Editor { 
    633633                }
    634634
    635635                // Set correct file permissions
    636                 $stat = stat( dirname( $filename ) );
     636                $stat = stat( trailingslashit ( dirname( $filename ) ) );
    637637                $perms = $stat['mode'] & 0000666; //same permissions as parent folder, strip off the executable bits
    638638                @ chmod( $filename, $perms );
    639639
  • wp-includes/functions.php

    diff --git a/wp-includes/functions.php b/wp-includes/functions.php
    index bfc93eed77..180052588c 100644
    a b function wp_upload_bits( $name, $deprecated, $bits, $time = null ) { 
    21862186        clearstatcache();
    21872187
    21882188        // Set correct file permissions
    2189         $stat = @ stat( dirname( $new_file ) );
     2189        $stat = @ stat( trailingslashit( dirname( $new_file ) ) );
    21902190        $perms = $stat['mode'] & 0007777;
    21912191        $perms = $perms & 0000666;
    21922192        @ chmod( $new_file, $perms );