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. Built from https://develop.svn.wordpress.org/trunk@37983 git-svn-id: http://core.svn.wordpress.org/trunk@37924 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -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 ) );
|
||||
|
||||
Reference in New Issue
Block a user