Make WordPress Core


Ignore:
Timestamp:
08/20/2016 11:35:50 PM (8 years ago)
Author:
wonderboymusic
Message:

Media: when calling pathinfo(), also pass a PATHINFO_* constant to avoid array notices for unset keys.

Props JaworskiMatt.
Fixes #37608.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/media.php

    r38029 r38294  
    285285        return new WP_Error( 'upload_error', $file['error'] );
    286286
    287     $name_parts = pathinfo($name);
    288     $name = trim( substr( $name, 0, -(1 + strlen($name_parts['extension'])) ) );
     287    $basename = pathinfo( $name, PATHINFO_BASENAME );
    289288
    290289    $url = $file['url'];
    291290    $type = $file['type'];
    292291    $file = $file['file'];
    293     $title = $name;
     292    $title = $basename;
    294293    $content = '';
    295294    $excerpt = '';
Note: See TracChangeset for help on using the changeset viewer.