Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#31044 closed defect (bug) (fixed)

attachment_url_to_postid() does not always return result

Reported by: sergeybiryukov's profile SergeyBiryukov Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 4.2 Priority: normal
Severity: normal Version:
Component: Media Keywords: good-first-bug has-patch
Focuses: Cc:

Description

attachment_url_to_postid() should always return an integer, like url_to_postid() does.

Currently, if the ID is not found, it returns nothing.

Attachments (2)

31044.diff (408 bytes) - added by nathan_dawson 9 years ago.
Patch for attachment_url_to_postid
trac.31044.diff (367 bytes) - added by ashfame 9 years ago.
Adding my version of patch so that after the query, we judge the condition and return appropriate value in one go.

Download all attachments as: .zip

Change History (4)

@nathan_dawson
9 years ago

Patch for attachment_url_to_postid

@ashfame
9 years ago

Adding my version of patch so that after the query, we judge the condition and return appropriate value in one go.

#1 @ashfame
9 years ago

  • Keywords has-patch added; needs-patch removed

#2 @SergeyBiryukov
9 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 31239:

attachment_url_to_postid() should always return an integer.

props nathan_dawson, ashfame.
fixes #31044.

Note: See TracTickets for help on using tickets.