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
This commit is contained in:
Dion Hulse 2017-11-27 03:28:48 +00:00
parent 28677d382d
commit daacc37405
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 = '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.