#8428 closed defect (bug) (fixed)
wp_mkdir_p function endless recursion
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 2.7 | Priority: | high |
| Severity: | critical | Version: | 2.6.1 |
| Component: | Upload | Keywords: | wp_mkdir_p, upload_path |
| Focuses: | Cc: |
Description
I've moved my WP 2.6.2 to another hosting but forgot to change settings for directory to store upload data in.
On file upload I saw attempts of creating such directories:
/home/falcon/data/www/blog.stfalcon.com/wp-content/uploads/2008/11 /home/falcon/data/www/blog.stfalcon.com/wp-content/uploads/2008 /home/falcon/data/www/blog.stfalcon.com/wp-content/uploads /home/falcon/data/www/blog.stfalcon.com/wp-content /home/falcon/data/www/blog.stfalcon.com /home/falcon/data/www /home/falcon/data /home/falcon /home ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ...
Seems this function shouldn't try to create any directories when / is reached.
Change History (4)
#2
@
17 years ago
this function should just stop creating directories once / is reached.
Currently it is:
function wp_mkdir_p( $target ) {
// from php.net/mkdir user contributed notes
$target = str_replace( '//', '/', $target );
if ( file_exists( $target ) )
return @is_dir( $target );
// Attempting to create the directory may clutter up our display.
if ( @mkdir( $target ) ) {
$stat = @stat( dirname( $target ) );
$dir_perms = $stat['mode'] & 0007777; // Get the permission bits.
@chmod( $target, $dir_perms );
return true;
} elseif ( is_dir( dirname( $target ) ) ) {
return false;
}
// If the above failed, attempt to create the parent node, then try again.
if ( wp_mkdir_p( dirname( $target ) ) )
return wp_mkdir_p( $target );
return false;
}
It should probably be:
if ( wp_mkdir_p( dirname( $target ) ) && $target != '/') return wp_mkdir_p( $target );
Note: See
TracTickets for help on using
tickets.
So basically, the problem is that you didn't change the settings and now that you did it works perfectly or that you think it should stop once it reaches the point where it no longer has permissions to precede further?