From f501814eacaabc91f72d42e40660f7a5c1da61d4 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 22 Dec 2019 02:45:03 +0000 Subject: [PATCH] Upgrade/Install: When creating the `.htaccess` file in `insert_with_markers()`, make sure it has `0644` as a minimum set of permissions. Props rcutmore, dd32, i3anaan. Fixes #40572. Built from https://develop.svn.wordpress.org/trunk@47005 git-svn-id: http://core.svn.wordpress.org/trunk@46805 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/misc.php | 7 +++++++ wp-includes/version.php | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/wp-admin/includes/misc.php b/wp-admin/includes/misc.php index 428b2980a5..6b0c311658 100644 --- a/wp-admin/includes/misc.php +++ b/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; } diff --git a/wp-includes/version.php b/wp-includes/version.php index 4cf8d90313..68e7022299 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.4-alpha-47004'; +$wp_version = '5.4-alpha-47005'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.