WordPress.org

Make WordPress Core

Ticket #26781: dirperms.diff

File dirperms.diff, 730 bytes (added by fboender, 7 years ago)

Fix umask influence check in wp_mkdir_p.

  • src/wp-includes/functions.php

     
    13781378        if ( @mkdir( $target, $dir_perms, true ) ) {
    13791379
    13801380                // If a umask is set that modifies $dir_perms, we'll have to re-set the $dir_perms correctly with chmod()
    1381                 if ( $dir_perms != $dir_perms & ~umask() ) {
     1381                if ( $dir_perms != ( $dir_perms & ~umask() ) ) {
    13821382                        $folder_parts = explode( '/', substr( $target, strlen( $target_parent ) + 1 ) );
    13831383                        for ( $i = 1; $i <= count( $folder_parts ); $i++ ) {
    13841384                                @chmod( $target_parent . '/' . implode( '/', array_slice( $folder_parts, 0, $i ) ), $dir_perms );