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.

Merges [42244] to the 4.9 branch.
Fixes #42609.

Built from https://develop.svn.wordpress.org/branches/4.9@42245


git-svn-id: http://core.svn.wordpress.org/branches/4.9@42074 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dion Hulse 2017-11-27 03:29:25 +00:00
parent e1095eeb9f
commit 9fe3e9edf0
2 changed files with 3 additions and 2 deletions

View File

@ -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.' ) );
}

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.9.1-alpha-42243';
$wp_version = '4.9.1-alpha-42245';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.