WordPress.org

Make WordPress Core

Ticket #16953: 16953.10.diff

File 16953.10.diff, 649 bytes (added by iandunn, 6 years ago)

Check if $wp_plugin_paths is an array

  • src/wp-includes/plugin.php

     
    617617function plugin_basename( $file ) {
    618618        global $wp_plugin_paths;
    619619
    620         foreach ( $wp_plugin_paths as $dir => $realdir ) {
    621                 if ( strpos( $file, $realdir ) === 0 ) {
    622                         $file = $dir . substr( $file, strlen( $realdir ) );
     620        if ( is_array( $wp_plugin_paths ) ) {
     621                foreach ( $wp_plugin_paths as $dir => $realdir ) {
     622                        if ( strpos( $file, $realdir ) === 0 ) {
     623                                $file = $dir . substr( $file, strlen( $realdir ) );
     624                        }
    623625                }
    624626        }
    625627