From daacc3740557e2a0051ad0f1c9280ce392ecc325 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Mon, 27 Nov 2017 03:28:48 +0000 Subject: [PATCH] Theme Editor: Validate files are editable based on their relative filenames, rather than full file path. This fixes theme editing on Windows platforms where `validate_file()` will return `2` on a full file path. Fixes #42609. Built from https://develop.svn.wordpress.org/trunk@42244 git-svn-id: http://core.svn.wordpress.org/trunk@42073 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/file.php | 3 ++- wp-includes/version.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/wp-admin/includes/file.php b/wp-admin/includes/file.php index ccd1a2e240..4144a79e33 100644 --- a/wp-admin/includes/file.php +++ b/wp-admin/includes/file.php @@ -445,7 +445,8 @@ function wp_edit_theme_plugin_file( $args ) { } } - if ( 0 !== validate_file( $real_file, $allowed_files ) ) { + // Compare based on relative paths + if ( 0 !== validate_file( $file, array_keys( $allowed_files ) ) ) { return new WP_Error( 'disallowed_theme_file', __( 'Sorry, that file cannot be edited.' ) ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index 20a5523ba9..04d33a6640 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '5.0-alpha-42242'; +$wp_version = '5.0-alpha-42244'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.