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 ) { |
861 | 861 | } |
862 | 862 | |
863 | 863 | // Set correct file permissions. |
864 | | $stat = stat( dirname( $new_file )); |
| 864 | $stat = stat( trailingslashit( dirname( $new_file ) ) ); |
865 | 865 | $perms = $stat['mode'] & 0000666; |
866 | 866 | @ chmod( $new_file, $perms ); |
867 | 867 | |
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 { |
404 | 404 | } |
405 | 405 | |
406 | 406 | // Set correct file permissions |
407 | | $stat = stat( dirname( $filename ) ); |
| 407 | $stat = stat( trailingslashit ( dirname( $filename ) ) ); |
408 | 408 | $perms = $stat['mode'] & 0000666; //same permissions as parent folder, strip off the executable bits |
409 | 409 | @ chmod( $filename, $perms ); |
410 | 410 | |
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 { |
633 | 633 | } |
634 | 634 | |
635 | 635 | // Set correct file permissions |
636 | | $stat = stat( dirname( $filename ) ); |
| 636 | $stat = stat( trailingslashit ( dirname( $filename ) ) ); |
637 | 637 | $perms = $stat['mode'] & 0000666; //same permissions as parent folder, strip off the executable bits |
638 | 638 | @ chmod( $filename, $perms ); |
639 | 639 | |
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 ) { |
2186 | 2186 | clearstatcache(); |
2187 | 2187 | |
2188 | 2188 | // Set correct file permissions |
2189 | | $stat = @ stat( dirname( $new_file ) ); |
| 2189 | $stat = @ stat( trailingslashit( dirname( $new_file ) ) ); |
2190 | 2190 | $perms = $stat['mode'] & 0007777; |
2191 | 2191 | $perms = $perms & 0000666; |
2192 | 2192 | @ chmod( $new_file, $perms ); |