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-includes/class-wp-image-editor.php

    r37492 r38294  
    347347
    348348        if ( $filename ) {
    349             $ext = '';
    350             $info = pathinfo( $filename );
    351             $dir  = $info['dirname'];
    352 
    353             if ( isset( $info['extension'] ) )
    354                 $ext = $info['extension'];
     349            $dir = pathinfo( $filename, PATHINFO_DIRNAME );
     350            $ext = pathinfo( $filename, PATHINFO_EXTENSION );
    355351
    356352            $filename = trailingslashit( $dir ) . wp_basename( $filename, ".$ext" ) . ".{$new_ext}";
     
    376372            $suffix = $this->get_suffix();
    377373
    378         $info = pathinfo( $this->file );
    379         $dir  = $info['dirname'];
    380         $ext  = $info['extension'];
     374        $dir  = pathinfo( $this->file, PATHINFO_DIRNAME );
     375        $ext  = pathinfo( $this->file, PATHINFO_EXTENSION );
    381376
    382377        $name = wp_basename( $this->file, ".$ext" );
Note: See TracChangeset for help on using the changeset viewer.