Opened 13 months ago

Closed 3 months ago

Last modified 3 months 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:

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

Download all attachments as: .zip

Change History (14)

Bugfix

bugfix + parameter post id

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

I imagine this has been around since 2.0.

  • 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 to strictly.

Version 0, edited 9 months ago by MikeHansenMe (next)
  • Milestone changed from Awaiting Review to 3.6

Related: #23304

In 23350:

Add missing inline descriptions.

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

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

comment:7 follow-up: ↓ 8   nacin4 months ago

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

comment:8 in reply to: ↑ 7 ; follow-up: ↓ 10   SergeyBiryukov4 months 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.

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

In 23433:

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

comment:10 in reply to: ↑ 8   SergeyBiryukov3 months 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.