Make WordPress Core

Opened 14 years ago

Closed 13 years ago

#13810 closed defect (bug) (fixed)

media form errors not displaying on /wp-admin/media.php?action=edit&attachment_id=##

Reported by: andyblackwell's profile andyblackwell Owned by: andyblackwell's profile andyblackwell
Milestone: 3.1 Priority: normal
Severity: normal Version: 3.0
Component: Administration Keywords: has-patch commit
Focuses: Cc:

Description

form errors not showing on the single media edit page:
/wp-admin/media.php?action=edit&attachment_id=##

This is due to the $errors array being passed incorrectly to the get_media_item() function in /wp-admin/media.php. The $errors array is sent back from media_upload_form_handler() as an array of error arrays having attachment ids as the key for each. Was simply an accident of passing the full array ($errors) rather than just the key needed ($errors[$attachment->ID]) causing a bad array merge later which is why the errors don't display. Probably happened because the full $errors array is passed to the plural get_media_items() function.

Looks like this bug has gone unnoticed since at least early 2008.

Patch included.

Attachments (1)

media.php-r14139.patch (652 bytes) - added by andyblackwell 14 years ago.
patch for /wp-admin/media.php

Download all attachments as: .zip

Change History (5)

@andyblackwell
14 years ago

patch for /wp-admin/media.php

#1 @andyblackwell
14 years ago

  • Status changed from new to accepted

#2 @andyblackwell
14 years ago

an easy way to add an error for testing is to make the required 'title' field blank in the media form, triggering the error: "Empty Title filled from filename."

If you don't see that error underneath the field, things aren't working properly.

In the modal popup version, just click 'show' on the new item in the gallery list after an upload->save to see the error message. This is another bug I submitted a patch for (#13838) which is css related, if there are errors in this form it should show by default (css class 'startopen') but that class oddly has 'display:none' attached to it in a few places in the css breaking that functionality.

#3 @nacin
13 years ago

  • Keywords commit added
  • Milestone changed from Awaiting Review to 3.1

Looks good.

#4 @ryan
13 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

(In [16812]) Fix media form error display. Props andyblackwell. fixes #13810

Note: See TracTickets for help on using tickets.