Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#31044 closed defect (bug) (fixed)

attachment_url_to_postid() does not always return result

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

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 12 years ago.
Patch for attachment_url_to_postid
trac.31044.diff (367 bytes ) - added by ashfame 12 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
12 years ago

Patch for attachment_url_to_postid

@ashfame
12 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
12 years ago

  • Keywords has-patch added; needs-patch removed

#2 @SergeyBiryukov
12 years ago

  • Owner set to SergeyBiryukov
  • Resolutionfixed
  • Status newclosed

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.