Plugins: In plugin_basename() normalize the file path before unresolving symlinks.

`$wp_plugin_paths` contains normalized paths, see `wp_register_plugin_realpath()`.

Props jdgrimes, voldemortensen, flyingdr, ocean90.
Fixes #29154.
Built from https://develop.svn.wordpress.org/trunk@37332


git-svn-id: http://core.svn.wordpress.org/trunk@37298 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dominik Schilling 2016-04-30 15:09:27 +00:00
parent 697a6d5560
commit 4b51bc18cc
2 changed files with 4 additions and 2 deletions

View File

@ -675,13 +675,15 @@ function remove_all_actions($tag, $priority = false) {
function plugin_basename( $file ) {
global $wp_plugin_paths;
// $wp_plugin_paths contains normalized paths.
$file = wp_normalize_path( $file );
foreach ( $wp_plugin_paths as $dir => $realdir ) {
if ( strpos( $file, $realdir ) === 0 ) {
$file = $dir . substr( $file, strlen( $realdir ) );
}
}
$file = wp_normalize_path( $file );
$plugin_dir = wp_normalize_path( WP_PLUGIN_DIR );
$mu_plugin_dir = wp_normalize_path( WPMU_PLUGIN_DIR );

View File

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