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

@@ -284,13 +284,12 @@ function media_handle_upload($file_id, $post_id, $post_data = array(), $override
if ( isset($file['error']) )
return new WP_Error( 'upload_error', $file['error'] );
$name_parts = pathinfo($name);
$name = trim( substr( $name, 0, -(1 + strlen($name_parts['extension'])) ) );
$basename = pathinfo( $name, PATHINFO_BASENAME );
$url = $file['url'];
$type = $file['type'];
$file = $file['file'];
$title = $name;
$title = $basename;
$content = '';
$excerpt = '';