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:
Dominik Schilling 2016-07-06 09:45:27 +00:00
parent f1b7a9c77d
commit dc994f5db5
2 changed files with 2 additions and 1 deletions

View File

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

View File

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