Fix wp_mkdir_p() when running under safe_mode on certain PHP versions. Props Denis-de-Bernardy. Fixes #8830

git-svn-id: https://develop.svn.wordpress.org/trunk@12740 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dion Hulse 2010-01-17 02:44:47 +00:00
parent f44d88c4e1
commit 95166aa0cf
1 changed files with 6 additions and 0 deletions

View File

@ -1933,6 +1933,12 @@ function wp_get_original_referer() {
function wp_mkdir_p( $target ) { function wp_mkdir_p( $target ) {
// from php.net/mkdir user contributed notes // from php.net/mkdir user contributed notes
$target = str_replace( '//', '/', $target ); $target = str_replace( '//', '/', $target );
// safe mode fails with trailing slash under certain PHP versions.
$target = untrailingslashit($target);
if ( empty($target) )
$target = '/';
if ( file_exists( $target ) ) if ( file_exists( $target ) )
return @is_dir( $target ); return @is_dir( $target );