Plugins: In plugin_basename() sort plugin paths before resolving symlinks.

`arsort()` sorts the paths reverse-alphabetically while preserving the keys. It results in a longer path being listed before a shorter one with the same base directory(ies).

Props jdgrimes, ocean90.
Fixes #28441.

git-svn-id: https://develop.svn.wordpress.org/trunk@37983 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dominik Schilling
2016-07-06 09:44:58 +00:00
parent ad52e49e4f
commit 0037aa1dd5
2 changed files with 45 additions and 7 deletions

View File

@@ -731,6 +731,7 @@ function plugin_basename( $file ) {
// $wp_plugin_paths contains normalized paths.
$file = wp_normalize_path( $file );
arsort( $wp_plugin_paths );
foreach ( $wp_plugin_paths as $dir => $realdir ) {
if ( strpos( $file, $realdir ) === 0 ) {
$file = $dir . substr( $file, strlen( $realdir ) );