[wp-trac] [WordPress Trac] #2889: duplicate content when submitting comments

WordPress Trac wp-trac at lists.automattic.com
Sat Jul 1 09:06:46 GMT 2006


#2889: duplicate content when submitting comments
---------------------+------------------------------------------------------
 Reporter:  whooami  |       Owner:  anonymous
     Type:  defect   |      Status:  new      
 Priority:  high     |   Milestone:           
Component:  General  |     Version:  2.0.3    
 Severity:  normal   |    Keywords:           
---------------------+------------------------------------------------------
 An example of the problem is viewable on my brand new sandbox blog @
 http://www.village-idiot.org/test-install/?p=1#comments

 That is a brand new install with NO plugins installed.

 Essentially what is happening is that link is being filtered twice and
 content is being added to the comment.

  When you view the source for the second comment, you will notice that
 nofollow tags are changed - thats because I edited the make_clickable
 function and the wp_rel_nofollow function:


 {{{
 function wp_rel_nofollow( $text ) {
         $text = preg_replace('|<a (.+?)>|i', '<a $1 rel="nofollow-
 function">', $text);
         return $text;
 }
 }}}


 {{{
 function make_clickable($ret) {
         $ret = ' ' . $ret . ' ';
         $ret =
 preg_replace("#([\s>])(https?)://([^\s<>{}()]+[^\s.,<>{}()])#i", "$1<a
 href='$2://$3' rel='nofollow-clickable'>$2://$3</a>", $ret);
         $ret =
 preg_replace("#(\s)www\.([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[^
 <>{}()\n\r]*[^., <>{}()\n\r]?)?)#i", "$1<a href='http://www.$2.$3$4' rel
 ='nofollow-clickable'>www.$2.$3$4</a>", $ret);
         $ret = preg_replace("#(\s)([a-z0-9\-_.]+)@([a-z0-9\-_.]+)\.([^,<
 \n\r]+)#i", "$1<a href=\"mailto:$2@$3.$4\">$2@$3.$4</a>", $ret);
         $ret = trim($ret);
         return $ret;
 }

 }}}

 Now the source for the link in question:


 {{{
 <a href="http://www.test.com" rel="nofollow-function"><a
 href='http://www.test.com' rel='nofollow-
 clickable'>http://www.test.com</a></a>
 }}}

 the comment I submitted was:


 {{{
 <a href="http://www.test.com">http://www.test.com</a>
 }}}

 Obviously thats not correct.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/2889>
WordPress Trac <http://wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list