Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#25236 closed defect (bug) (fixed)

media.php undefined index.

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

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 11 years ago.
25236.patch (1.4 KB) - added by SergeyBiryukov 11 years ago.

Download all attachments as: .zip

Change History (5)

11 years ago

#1 @SergeyBiryukov
11 years ago

  • Milestone changed from Awaiting Review to 3.7

#2 @SergeyBiryukov
11 years ago

  • Description modified (diff)
  • Keywords commit added
  • Version set to 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 11 years ago by SergeyBiryukov (previous) (diff)

#3 @SergeyBiryukov
11 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to 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.