Make WordPress Core

Opened 13 years ago

Closed 13 years ago

#25236 closed defect (bug) (fixed)

media.php undefined index.

Reported by: pross Owned by: SergeyBiryukov
Priority: normal Milestone: 3.7
Component: Media Version: 3.5
Severity: normal Keywords: has-patch commit
Cc: Focuses:

Description (last modified by SergeyBiryukov)

If a image is edited and the title is blank an undefined index is produced as it is looking for $post['guid'] which is not set.

Attachments (2)

media.patch​ (712 bytes ) - added by pross 13 years ago.
25236.patch​ (1.4 KB ) - added by SergeyBiryukov 13 years ago.

Download all attachments as: .zip

Change History (5)

#1 @SergeyBiryukov
13 years ago

  • Milestone Awaiting Review → 3.7

#2 @SergeyBiryukov
13 years ago

  • Description modified (diff)
  • Keywords commit added
  • Version → 3.5

Introduced in [22783] and [23094].

In 3.4, attachment_fields_to_save filter was only called in media_upload_form_handler() for a post array received from get_post(), which contained a guid field: tags/3.6/wp-admin/includes/media.php#517​.

Since 3.5, it's also called in edit_post() for an array that contains an attachment_url field instead: tags/3.6/wp-admin/includes/post.php#L264​.

I'd suggest checking both fields, as long as we still have both scenarios in core. Although the former one is no longer used in the new media UI, there's a ​plugin that re-enables the old UI.

We should also replace basename() with wp_basename(), as in [22367] and [24585]. See 25236.patch​.

Last edited 13 years ago by SergeyBiryukov (previous) (diff)

#3 @SergeyBiryukov
13 years ago

  • Owner set to SergeyBiryukov
  • Resolution → fixed
  • Status new → closed

In 25277:

Use correct array key for filling the attachment title in image_attachment_fields_to_save(). props pross.
Use wp_basename() to avoid issues with UTF-8 characters.
fixes #25236.

Note: See TracTickets for help on using tickets.