Ticket #29154: 29154.3.diff
File 29154.3.diff, 1.6 KB (added by , 8 years ago) |
---|
-
src/wp-includes/plugin.php
675 675 function plugin_basename( $file ) { 676 676 global $wp_plugin_paths; 677 677 678 // $wp_plugin_paths contains normalized paths. 679 $file = wp_normalize_path( $file ); 680 678 681 foreach ( $wp_plugin_paths as $dir => $realdir ) { 679 682 if ( strpos( $file, $realdir ) === 0 ) { 680 683 $file = $dir . substr( $file, strlen( $realdir ) ); 681 684 } 682 685 } 683 686 684 $file = wp_normalize_path( $file );685 687 $plugin_dir = wp_normalize_path( WP_PLUGIN_DIR ); 686 688 $mu_plugin_dir = wp_normalize_path( WPMU_PLUGIN_DIR ); 687 689 -
tests/phpunit/tests/functions/pluginBasename.php
1 <?php 2 3 /** 4 * Tests for plugin_basename() 5 * 6 * @group functions.php 7 * @group plugins 8 */ 9 class Tests_Plugin_Basename extends WP_UnitTestCase { 10 11 /** 12 * @ticket 29154 13 */ 14 function test_should_return_correct_basename_for_symlinked_plugins() { 15 global $wp_plugin_paths; 16 17 $old_wp_plugin_paths = $wp_plugin_paths; 18 19 $wp_plugin_paths[ WP_PLUGIN_DIR . '/a-symlinked-plugin' ] = 'C:/www/path/plugins/a-plugin'; 20 21 $basename = plugin_basename( 'c:\www\path\plugins\a-plugin\plugin.php' ); 22 23 $wp_plugin_paths = $old_wp_plugin_paths; 24 25 $this->assertSame( 'a-symlinked-plugin/plugin.php', $basename ); 26 } 27 }