Opened 11 years ago
Closed 11 years ago
#24805 closed defect (bug) (invalid)
Error when uploading MP3 with embedded cover image
Reported by: | tollmanz | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | major | Version: | 3.6 |
Component: | Media | Keywords: | has-patch |
Focuses: | Cc: |
Description
When uploading an MP3 with an embedded album cover and the appropriate theme support and post type support enabled, an error is thrown when the MP3 upload completes.
To Reproduce:
- Activate Twenty Thirteen
- Add the following to its functions.php file (as indicated in 23673):
add_post_type_support( 'attachment:audio', 'thumbnail' ); add_post_type_support( 'attachment:video', 'thumbnail' ); add_theme_support( 'post-thumbnails', 'attachment:audio' ); add_theme_support( 'post-thumbnails', 'attachment:video' );
- Go to Posts → Add New
- Enter a title
- Choose Audio in the Format metabox
- Click Add Media
- Drag an MP3 with an embedded image into the lightbox
- The MP3 uploads
- On completion, the following error message is displayed: "Error 2-01 On A Good Day.mp3 An error occurred in the upload. Please try again later."
- The MP3 is not shown in the media area
- Click the X to close the window
- Click Save Draft
- Upon reload, click Add Media
- The MP3 file and the album cover are now available to be selected
Just to be clear, the MP3 and the album cover both upload successfully; however, the error is displayed, which blocks you from choosing the MP3 and inserting into into the post until you reload the post edit screen.
Attachments (2)
Change History (12)
#6
@
11 years ago
- Keywords has-patch added
I was getting 2 errors
PHP Warning: in_array() expects parameter 2 to be array, string given in /Users/scott/git/wordpress/wp-includes/theme.php on line 1547
AND
PHP Notice: Undefined variable: post_title in /Users/scott/git/wordpress/wp-includes/post.php on line 3921
PHP Notice: Undefined variable: post_title in /Users/scott/git/wordpress/wp-includes/post.php on line 3988
The theme support expects an array:
add_theme_support( 'post-thumbnails', array( 'attachment:audio', 'attachment:video' ) );
I don't think an array should be required.
And post_title
doesn't have an empty default in wp_insert_attachment()
- it does in wp_insert_post()
on line 2635.
Uploading patch.
#7
@
11 years ago
Also, add_theme_support() stomps — #22080. The code in the ticket description would result (if it had worked) in only video supported.
Is post_title something that is required of wp_insert_attachment()? What's the backtrace on this, where is this being called without a post_title? wp_generate_attachment_metadata()? Surprised no one has pointed out this notice before.
I imagine that if display_errors is off, this will go away as the XHR won't be messed with by a warning.
Strongly suggest punt on all of it.
Can you upload an mp3 with an embedded cover image that others can use for testing?