[wp-trac] [WordPress Trac] #54464: Twenty Twenty-One get_attachment_image_attributes_image_attributes not checking if variable isset properly

WordPress Trac noreply at wordpress.org
Fri Nov 19 17:54:58 UTC 2021


#54464: Twenty Twenty-One get_attachment_image_attributes_image_attributes not
checking if variable isset properly
---------------------------------------------+-----------------------
 Reporter:  wetah                            |       Owner:  audrasjb
     Type:  defect (bug)                     |      Status:  closed
 Priority:  normal                           |   Milestone:  5.9
Component:  Bundled Theme                    |     Version:
 Severity:  normal                           |  Resolution:  fixed
 Keywords:  good-first-bug has-patch commit  |     Focuses:  template
---------------------------------------------+-----------------------
Changes (by audrasjb):

 * status:  reviewing => closed
 * resolution:   => fixed


Comment:

 In [changeset:"52217" 52217]:
 {{{
 #!CommitTicketReference repository="" revision="52217"
 Twenty Twenty-One: Prevent notice thrown in
 `twenty_twenty_one_get_attachment_image_attributes()`.

 Calling `twenty_twenty_one_get_attachment_image_attributes()` was causing
 an `Undefined index: width|height` notice to be thrown when the result
 from `wp_get_attachment_metadata()` does not set any value to `$meta`.
 This change adds an `isset()` check to prevent it.

 Props wetah, hasanuzzamanshamim.
 Fixes #54464.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54464#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list