Make WordPress Core


Ignore:
Timestamp:
11/28/2013 02:19:24 AM (11 years ago)
Author:
dd32
Message:

Fix a regression in wp_mkdir_p() where the $mode of the parent folder is not correctly applied to all created paths. Fixes #25822 for trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/functions.php

    r26299 r26449  
    13841384
    13851385    // Get the permission bits.
    1386     if ( $target_parent && '.' != $target_parent ) {
    1387         $stat = @stat( $target_parent );
     1386    $dir_perms = false;
     1387    if ( $stat = @stat( $target_parent ) ) {
    13881388        $dir_perms = $stat['mode'] & 0007777;
    13891389    } else {
     
    13921392
    13931393    if ( @mkdir( $target, $dir_perms, true ) ) {
     1394
     1395        // If a umask is set that modifies $dir_perms, we'll have to re-set the $dir_perms correctly with chmod()
     1396        if ( $dir_perms != $dir_perms & ~umask() ) {
     1397            $folder_parts = explode( '/', substr( $target, strlen( $target_parent ) + 1 ) );
     1398            for ( $i = 1; $i <= count( $folder_parts ); $i++ ) {
     1399                @chmod( $target_parent . '/' . implode( '/', array_slice( $folder_parts, 0, $i ) ), $dir_perms );
     1400            }
     1401        }
     1402
    13941403        return true;
    13951404    }
Note: See TracChangeset for help on using the changeset viewer.