Make WordPress Core

Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#20494 closed enhancement (fixed)

comment_exists function return improper value

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

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 14 years ago.
Bugfix
comment_exists.patch​ (1.5 KB ) - added by momo360modena 14 years ago.
bugfix + parameter post id
20494.docs.patch​ (507 bytes ) - added by SergeyBiryukov 14 years ago.

Download all attachments as: .zip

Change History (14)

@momo360modena
14 years ago

bugfix + parameter post id

#1 @momo360modena
14 years ago

  • Summary comment_exists function return inconsitly values → comment_exists function return improper value

#2 @nacin
14 years ago

  • Version 3.4 → 2.0

I imagine this has been around since 2.0.

#3 @MikeHansenMe
14 years ago

  • Keywords dev-feedback added
  • Type defect (bug) → 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 14 years ago by MikeHansenMe (previous) (diff)

#4 @SergeyBiryukov
14 years ago

  • Milestone Awaiting Review → 3.6

Related: #23304

#5 @SergeyBiryukov
14 years ago

In 23350:

Add missing inline descriptions.

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

#6 @SergeyBiryukov
14 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
14 years ago

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

#8 in reply to: ↑ 7 ; follow-up: @SergeyBiryukov
14 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
14 years ago

  • Owner set to SergeyBiryukov
  • Resolution → fixed
  • Status new → closed

In 23433:

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

#10 in reply to: ↑ 8 @SergeyBiryukov
14 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.