Ticket #3052 (new defect (bug))

Opened 2 years ago

Last modified 1 year ago

pingback_ping() function displays wrong content in pingback-display in some occurances

Reported by: webrocker Assigned to: anonymous
Priority: normal Milestone: 2.9
Component: XML-RPC Version: 2.0.4
Severity: normal Keywords: pingback xmlrpc.php has-patch 2nd-opinion
Cc: josephscott

Description

If the blog uses a template where the post-meta-data like the trackback-link and such is wrapped in a "div" tag but not in a "p" tag, the pingback will incorrectly display the content surrounding the meta-data-links, not the content of the pinging post. if there is a "related posts" navigation on the page (possible with the ultimate-tag-warrior plugin), or any other links inside the page that link to other posts from the same blog (even the next post, previous post links), pingbacks will display the content around the first of these links, not the contents around the "pinging" link inside the post. Possible fix: on line 1192 in xmlrpc.php: $linea = preg_replace( “/ < (h1|h2|h3|h4|h5|h6|p|th|td|li|dt|dd|pre|caption|input|textarea|button|body)[^>]*>/”, “\n\n”, $linea ); the "div" tag is not recognized. changing that to: $linea = preg_replace( “/ < (h1|h2|h3|h4|h5|h6|p|th|td|li|dt|dd|pre|caption|input|textarea|button|body|div)[^>]*>/”, “\n\n”, $linea ); fixed the problems for my blog. Frankly I'm not that "deep" into regular expressions to fully understand what's going on inside the pingback_ping() function - but after inserting "div" to the line above my pingbacks display the correct excerpt of the pinging post, which they failed to do before.

Attachments

xmlrpc.php (36.4 kB) - added by webrocker on 08/31/06 08:25:10.
pingback_ping function patched on line 1192
xmlrpc.php.diff (0.6 kB) - added by webrocker on 09/19/06 08:38:48.

Change History

08/21/06 11:34:48 changed by Webrocker

  • keywords changed from pingback, xmlrpc.php, has fix to pingback|xmlrpc.php|has fix.
  • component changed from Administration to XML-RPC.

08/21/06 11:49:52 changed by Webrocker

sorry, i messed the formatting in the orig post... should read: (...) Possible fix: on line 1192 in xmlrpc.php:

$linea = preg_replace( “/ < (h1|h2|h3|h4|h5|h6|p|th|td|li|dt|dd|pre|caption|input|textarea|button|body)[^>]*>/”, “\n\n”, $linea );

the "div" tag is not recognized. changing that to:

$linea = preg_replace( “/ < (h1|h2|h3|h4|h5|h6|p|th|td|li|dt|dd|pre|caption|input|textarea|button|body|div)[^>]*>/”, “\n\n”, $linea );

fixed the problems for my blog. (...)

08/22/06 07:32:23 changed by webrocker

  • keywords changed from pingback|xmlrpc.php|has fix to reporter-feedback|pingback|xmlrpc.php|has fix.

hm. the problem re-occured in my blog today, despite my "fix". I use permalinks with "pathinfo", i.e.
http:/mydomain.tld/myblog/index.php/2006/08/12/my-title/
A post with a nearly identical title ("brave new internet revisited") to the pinged post ("brave new internet") produced a pingback with again the wrong contents in it; again the "related posts" navigation showed up as the excerpt in the pingback display.

08/22/06 09:20:26 changed by webrocker

ok, actually I have to deal with 2 different "bugs". the first is kind-of template related:
1) with the original xmlrpc.php, page-navigation- and meta-link-contents will show up as excerpt in the pingback, if they are wrapped inside <div></div> tags and not <p></p> tags. This can be fixed by adding div to the regex in line 1192 of the pingback_ping() function as stated above.

the second is caused by the use of the ultimate tag warrior plugin:
2) if it is used to display "related posts", and the pinging post has the same tags as the pinged post, the link to the pinged post will appear inside this "related posts" navigation - and the first appearance of that link will trigger the "excerpt" of the pingback. since the "related posts" navigation can appear anywhere inside the page, depending on the template, there is no way to tell which instance of the link is the "correct" one to use for the pingback excerpt. :-(
2) will only happen with pingbacks inside the same blog, 1) happens to "foreign" pingbacks as well, so I think 1) should be treated as a bug and 2)... hm, well, dunno.

08/22/06 09:37:01 changed by webrocker

I have no idea how to do this, but wouldn't it be possible to tell the pingback_ping function to "look" inside the main-content area instead of "looking" through the whole document? or the other way round, to exclude the navigation/sidebar area?

08/31/06 00:52:40 changed by foolswisdom

  • keywords changed from reporter-feedback|pingback|xmlrpc.php|has fix to pingback|xmlrpc.php|has fix.

webrocker, if you have a fix please attach it as a patch.

08/31/06 08:25:10 changed by webrocker

  • attachment xmlrpc.php added.

pingback_ping function patched on line 1192

09/19/06 08:38:48 changed by webrocker

  • attachment xmlrpc.php.diff added.

09/19/06 08:40:40 changed by webrocker

  • keywords changed from pingback|xmlrpc.php|has fix to pingback|xmlrpc.php|has patch|2nd opinion.

patch attached, now that I kind of know how to use svn ;-)

09/22/06 00:09:54 changed by foolswisdom

  • milestone set to 2.1.

11/30/06 23:01:50 changed by matt

  • milestone changed from 2.1 to 2.2.

03/27/07 22:31:47 changed by foolswisdom

  • keywords changed from pingback|xmlrpc.php|has patch|2nd opinion to pingback xmlrpc.php has-patch 2nd-opinion.
  • milestone changed from 2.2 to 2.3.

09/18/07 22:16:25 changed by foolswisdom

  • milestone changed from 2.3 to 2.5.

09/26/07 16:56:55 changed by josephscott

  • cc set to josephscott.