diff --git a/src/wp-admin/includes/misc.php b/src/wp-admin/includes/misc.php index 428b2980a5..6b0c311658 100644 --- a/src/wp-admin/includes/misc.php +++ b/src/wp-admin/includes/misc.php @@ -111,9 +111,16 @@ function insert_with_markers( $filename, $marker, $insertion ) { if ( ! is_writable( dirname( $filename ) ) ) { return false; } + if ( ! touch( $filename ) ) { return false; } + + // Make sure the file is created with a minimum set of permissions. + $perms = fileperms( $filename ); + if ( $perms ) { + chmod( $filename, $perms | 0644 ); + } } elseif ( ! is_writeable( $filename ) ) { return false; }