[wp-trac] Re: [WordPress Trac] #9069: Function get_comment_link
returns duplicate URLs for comments available at permalink
WordPress Trac
wp-trac at lists.automattic.com
Mon Mar 9 15:38:23 GMT 2009
#9069: Function get_comment_link returns duplicate URLs for comments available at
permalink
---------------------------+------------------------------------------------
Reporter: GregMulhauser | Owner: Viper007Bond
Type: defect (bug) | Status: new
Priority: normal | Milestone: 2.7.2
Component: Comments | Version: 2.7.1
Severity: normal | Keywords:
---------------------------+------------------------------------------------
Changes (by GregMulhauser):
* milestone: Future Release => 2.7.2
Comment:
Yes, I suppose you could either say 1) get_page_of_comment() should be
clever enough not to assume that a comment should be on a specific page
number when paging is not needed at all to reach that comment, or 2)
get_comment_link() should be clever enough not to listen to
get_page_of_comment() when the latter fails to distinguish between page 1
and paging not being needed at all. Either way, a whole new page of
comments gets created even when one does not need to exist, which is a
minor nuisance but nonetheless a nuisance. (There are other severe
problems in the new comments code, eg. #8841; this one is relatively
minor.)
The question of #comment-1 "not working" is a red herring: when comments
are ordered differently, we're no longer concerned with duplicate URLs for
comment 1, we're concerned with duplicate URLs for comment 1234, or some
other later comment. (It's just that that makes for a harder example to
illustrate the problem than just looking at comment 1.)
I've already written and tested the plugin to fix this, and it can be done
in around 20 lines of code, provided that get_comment_link is modified for
filtering. It's actually terribly inefficient for get_comment_link() to go
back and fix the incorrect assumption on the part of
get_page_of_comment(), but as I said in the original post, other bits of
code are already unfortunately relying on the existing behaviour of
get_page_of_comment(). If the latter could distinguish between page 1 and
not needing paging at all, the universe would be at peace once again, but
unfortunately the design decision has already been made that
get_page_of_comment() won't worry about that. At this late stage, I'm not
sure how the value returned by get_page_of_comment() could be fixed --
e.g., '0' or 'false', etc. -- to make that distinction without requiring
further modifications in other code. (Or maybe not that much would be
broken anyway? Maybe I'm being too cautious?)
I'm happy to supply the plugin code if it's felt that the behaviour of
get_comment_link() should be changed to make up for the assumption made by
get_page_of_comment(), but I'm skeptical that such a big and inefficient
change should really be forced on get_comment_link()...
Either way, I'm puzzled by why this would be moved to "Future Release"
when it's trivial to at least change the single line required to add the
filter to get_comment_link()... I hope it doesn't ruffle anyone's feathers
that I've changed it back to 2.7.2... I'm afraid I really don't know how
decisions are made about when to fix what bug, so I'm happy to be
corrected on this!
All the best,
Greg
--
Ticket URL: <http://core.trac.wordpress.org/ticket/9069#comment:5>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list