Make WordPress Core

Opened 12 years ago

Closed 11 years ago

Last modified 11 years ago

#20494 closed enhancement (fixed)

comment_exists function return improper value

Reported by: momo360modena's profile momo360modena Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 3.6 Priority: normal
Severity: minor Version: 2.0
Component: Comments Keywords: has-patch dev-feedback
Focuses: Cc:

Description

Hey,

The function comment_exists() return comment_post_ID instead comment_ID

PHPdoc say:

@return mixed Comment ID on success.

I submit 2 patches, one which only corrects the bug
And an another one with an additionnal parameter for this function, post id.

Attachments (3)

comment_exists_light.patch (815 bytes) - added by momo360modena 12 years ago.
Bugfix
comment_exists.patch (1.5 KB) - added by momo360modena 12 years ago.
bugfix + parameter post id
20494.docs.patch (507 bytes) - added by SergeyBiryukov 11 years ago.

Download all attachments as: .zip

Change History (14)

@momo360modena
12 years ago

bugfix + parameter post id

#1 @momo360modena
12 years ago

  • Summary changed from comment_exists function return inconsitly values to comment_exists function return improper value

#2 @nacin
12 years ago

  • Version changed from 3.4 to 2.0

I imagine this has been around since 2.0.

#3 @MikeHansenMe
12 years ago

  • Keywords dev-feedback added
  • Type changed from defect (bug) to enhancement

Tested both patches and they seem to be working correctly for me.

Also updated type from bug to enhancement since it does function currently just a bit too strictly.

Last edited 12 years ago by MikeHansenMe (previous) (diff)

#4 @SergeyBiryukov
11 years ago

  • Milestone changed from Awaiting Review to 3.6

Related: #23304

#5 @SergeyBiryukov
11 years ago

In 23350:

Add missing inline descriptions.

props momo360modena, aaronholbrook.
see #20494, fixes #23304.

#6 @SergeyBiryukov
11 years ago

comment_exists() is not used in core. Since it doesn't work as intended, we should probably deprecate it.

#7 follow-up: @nacin
11 years ago

comment_exists() and post_exists() both get used by importers, if I recall correctly.

#8 in reply to: ↑ 7 ; follow-up: @SergeyBiryukov
11 years ago

Replying to nacin:

comment_exists() and post_exists() both get used by importers, if I recall correctly.

Indeed.

Seems like we have two options:

  1. Correct the actual return value (comment_exists_light.patch).
  2. Only correct the docs (20494.docs.patch).

Given the usage in DotClear Importer and TextPattern Importer, I guess the first option makes the most sense.

#9 @SergeyBiryukov
11 years ago

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

In 23433:

Correct return value for comment_exists(). fixes #20494.

#10 in reply to: ↑ 8 @SergeyBiryukov
11 years ago

Replying to SergeyBiryukov:

DotClear Importer and TextPattern Importer treat the returned comment post ID as comment ID

Created #23482 for that.

Note: See TracTickets for help on using tickets.