[wp-trac] [WordPress Trac] #32755: media_sideload_image should return early when preg_match didn't match

WordPress Trac noreply at wordpress.org
Mon Jun 22 22:25:08 UTC 2015


#32755: media_sideload_image should return early when preg_match didn't match
-------------------------+-----------------------------
 Reporter:  serpent7776  |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Upload       |    Version:  4.2.2
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 If media_sideload_image function is given an url that does not match
 pattern
 {{{
 '/[^\?]+\.(jpe?g|jpe|gif|png)\b/i'
 }}}
 it should return with error instead of carrying on, because it raises a
 notice

 Notice: Undefined offset: 0 in <path>/wordpress/wp-
 admin/includes/media.php on line 840

 basicaly it tries to access
 {{{
 basename( $matches[0] )
 }}}
 but $matches is empty

--
Ticket URL: <https://core.trac.wordpress.org/ticket/32755>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list