Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#24805 closed defect (bug) (invalid)

Error when uploading MP3 with embedded cover image

Reported by: tollmanz's profile 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:

  1. Activate Twenty Thirteen
  2. 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' );
    
  3. Go to Posts → Add New
  4. Enter a title
  5. Choose Audio in the Format metabox
  6. Click Add Media
  7. Drag an MP3 with an embedded image into the lightbox
  8. The MP3 uploads
  9. 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."

http://f.cl.ly/items/2j0Q3d07421H1Y2w2C29/the-error.png

  1. The MP3 is not shown in the media area
  2. Click the X to close the window
  3. Click Save Draft
  4. Upon reload, click Add Media
  5. The MP3 file and the album cover are now available to be selected

http://f.cl.ly/items/0J2W1V2R1F203K0o243I/the-media.png

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)

13 Soul Calibur.mp3 (811.9 KB) - added by wonderboymusic 11 years ago.
24805.diff (1.3 KB) - added by wonderboymusic 11 years ago.

Download all attachments as: .zip

Change History (12)

#1 @wonderboymusic
11 years ago

  • Milestone changed from Awaiting Review to 3.6

#2 @nacin
11 years ago

Can you upload an mp3 with an embedded cover image that others can use for testing?

#3 @wonderboymusic
11 years ago

I just added one - I'll take a look at the bug

#4 @jupiterwise
11 years ago

  • Cc corey.mckrill@… added

#5 @tollmanz
11 years ago

I can confirm that @wonderboymusic's MP3 produces the error for me.

#6 @wonderboymusic
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 @nacin
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.

#8 @wonderboymusic
11 years ago

the 'post_title' thing happens when the image is slurped out of the ID3 tag and uploaded with no title - I view that addition as harmless

#9 @nacin
11 years ago

In 24759:

Add a default post_title value to wp_insert_attachment() to avoid a notice when there is no ID3 title.

props wonderboymusic.
see #24805.

#10 @nacin
11 years ago

  • Milestone 3.6 deleted
  • Resolution set to invalid
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.