#20494 closed enhancement (fixed)
comment_exists function return improper value
Reported by: | momo360modena | Owned by: | 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)
Change History (14)
#1
@
13 years ago
- Summary changed from comment_exists function return inconsitly values to comment_exists function return improper value
#3
@
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.
#6
@
12 years ago
comment_exists()
is not used in core. Since it doesn't work as intended, we should probably deprecate it.
#7
follow-up:
↓ 8
@
12 years ago
comment_exists() and post_exists() both get used by importers, if I recall correctly.
#8
in reply to:
↑ 7
;
follow-up:
↓ 10
@
12 years ago
Replying to nacin:
comment_exists() and post_exists() both get used by importers, if I recall correctly.
Indeed.
- Blogger Importer maintains its own copy of the function:
http://plugins.trac.wordpress.org/browser/blogger-importer/trunk/blogger-importer.php#L998 - Blogware Importer, GreyMatter Importer, Movable Type Importer, and WordPress Importer don't do anything with the returned value, other than checking if it's true:
http://plugins.trac.wordpress.org/browser/blogware-importer/trunk/blogware-importer.php#L159
http://plugins.trac.wordpress.org/browser/greymatter-importer/trunk/greymatter-importer.php#L291
http://plugins.trac.wordpress.org/browser/movabletype-importer/trunk/movabletype-importer.php#L291
http://plugins.trac.wordpress.org/browser/wordpress-importer/trunk/wordpress-importer.php#L671 - DotClear Importer and TextPattern Importer treat the returned comment post ID as comment ID, which is wrong:
http://plugins.trac.wordpress.org/browser/dotclear-importer/trunk/dotclear-importer.php#L416
http://plugins.trac.wordpress.org/browser/textpattern-importer/trunk/textpattern-importer.php#L429
Seems like we have two options:
- Correct the actual return value (comment_exists_light.patch).
- 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
@
12 years ago
- Owner set to SergeyBiryukov
- Resolution set to fixed
- Status changed from new to closed
In 23433:
#10
in reply to:
↑ 8
@
12 years ago
Replying to SergeyBiryukov:
DotClear Importer and TextPattern Importer treat the returned comment post ID as comment ID
Created #23482 for that.
Bugfix