Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#32755 closed defect (bug) (fixed)

media_sideload_image should return early when preg_match didn't match

Reported by: serpent7776's profile serpent7776 Owned by: chriscct7's profile chriscct7
Milestone: 4.4 Priority: normal
Severity: normal Version: 4.2.2
Component: Upload Keywords: has-patch commit
Focuses: Cc:


If media_sideload_image function is given an url that does not match pattern


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

Attachments (1)

32755.diff (606 bytes) - added by MikeHansenMe 9 years ago.

Download all attachments as: .zip

Change History (5)

9 years ago

#1 @MikeHansenMe
9 years ago

  • Keywords has-patch added

#2 @chriscct7
9 years ago

  • Keywords commit added
  • Milestone changed from Awaiting Review to 4.4
  • Owner set to chriscct7
  • Status changed from new to assigned

#3 @chriscct7
9 years ago

  • Type changed from enhancement to defect (bug)

#4 @SergeyBiryukov
9 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 34984:

Media: Return early from media_sideload_image() if $file didn't match the pattern for images.

Props MikeHansenMe, serpent7776.
Fixes #32755.

Note: See TracTickets for help on using tickets.