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

Props JaworskiMatt.
Fixes #37608.


git-svn-id: https://develop.svn.wordpress.org/trunk@38294 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor
2016-08-20 23:35:50 +00:00
parent a26f7f7d28
commit d911ef44dc
5 changed files with 41 additions and 37 deletions

View File

@@ -346,12 +346,8 @@ abstract class WP_Image_Editor {
}
if ( $filename ) {
$ext = '';
$info = pathinfo( $filename );
$dir = $info['dirname'];
if ( isset( $info['extension'] ) )
$ext = $info['extension'];
$dir = pathinfo( $filename, PATHINFO_DIRNAME );
$ext = pathinfo( $filename, PATHINFO_EXTENSION );
$filename = trailingslashit( $dir ) . wp_basename( $filename, ".$ext" ) . ".{$new_ext}";
}
@@ -375,9 +371,8 @@ abstract class WP_Image_Editor {
if ( ! $suffix )
$suffix = $this->get_suffix();
$info = pathinfo( $this->file );
$dir = $info['dirname'];
$ext = $info['extension'];
$dir = pathinfo( $this->file, PATHINFO_DIRNAME );
$ext = pathinfo( $this->file, PATHINFO_EXTENSION );
$name = wp_basename( $this->file, ".$ext" );
$new_ext = strtolower( $extension ? $extension : $ext );