[wp-trac] [WordPress Trac] #25236: media.php undefined index.

WordPress Trac noreply at wordpress.org
Fri Sep 6 12:59:55 UTC 2013


#25236: media.php undefined index.
------------------------------+------------------
 Reporter:  pross             |       Owner:
     Type:  defect (bug)      |      Status:  new
 Priority:  normal            |   Milestone:  3.7
Component:  Media             |     Version:  3.5
 Severity:  normal            |  Resolution:
 Keywords:  has-patch commit  |
------------------------------+------------------
Changes (by SergeyBiryukov):

 * keywords:  has-patch => has-patch commit
 * version:   => 3.5


Old description:

> 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.

New description:

 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.

--

Comment:

 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: [source: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: [source: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 [https://gist.github.com/brasofilo/4570587#file-old-upload-
 method-php plugin] that re-enables the old UI.

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

--
Ticket URL: <http://core.trac.wordpress.org/ticket/25236#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list