WordPress.org

Make WordPress Core

Opened 8 years ago

Last modified 4 years ago

#3052 reviewing defect (bug)

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

Reported by: webrocker Owned by: josephscott
Milestone: Future Release Priority: normal
Severity: normal Version: 2.0.4
Component: XML-RPC Keywords: has-patch close
Focuses: Cc:

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 (3)

xmlrpc.php (36.4 KB) - added by webrocker 8 years ago.
pingback_ping function patched on line 1192
xmlrpc.php.diff (646 bytes) - added by webrocker 8 years ago.
3052.diff (704 bytes) - added by Denis-de-Bernardy 5 years ago.
original patch, refreshed

Download all attachments as: .zip

Change History (25)

comment:1 Webrocker8 years ago

  • Component changed from Administration to XML-RPC
  • Keywords pingback|xmlrpc.php|has added; pingback xmlrpc.php has removed

comment:2 Webrocker8 years ago

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. (...)

comment:3 webrocker8 years ago

  • Keywords reporter-feedback|pingback|xmlrpc.php|has added; pingback|xmlrpc.php|has removed

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.

comment:4 webrocker8 years ago

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.

comment:5 webrocker8 years ago

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?

comment:6 foolswisdom8 years ago

  • Keywords pingback|xmlrpc.php|has added; reporter-feedback|pingback|xmlrpc.php|has removed

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

webrocker8 years ago

pingback_ping function patched on line 1192

webrocker8 years ago

comment:7 webrocker8 years ago

  • Keywords patch|2nd opinion added; fix removed

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

comment:8 foolswisdom8 years ago

  • Milestone set to 2.1

comment:9 matt7 years ago

  • Milestone changed from 2.1 to 2.2

comment:10 foolswisdom7 years ago

  • Keywords pingback xmlrpc.php has-patch 2nd-opinion added; pingback|xmlrpc.php|has patch|2nd opinion removed
  • Milestone changed from 2.2 to 2.3

comment:11 foolswisdom7 years ago

  • Milestone changed from 2.3 to 2.5

comment:12 josephscott7 years ago

  • Cc josephscott added

comment:13 Denis-de-Bernardy5 years ago

still current?

comment:14 Denis-de-Bernardy5 years ago

  • Resolution set to wontfix
  • Status changed from new to closed

this has been rotting for long enough

comment:15 Denis-de-Bernardy5 years ago

  • Milestone 2.9 deleted

Denis-de-Bernardy5 years ago

original patch, refreshed

comment:16 Denis-de-Bernardy5 years ago

  • Keywords needs-review added; 2nd-opinion removed
  • Milestone set to 2.9
  • Resolution wontfix deleted
  • Status changed from closed to reopened

refreshed the patch, in case there is any interest in this release

comment:17 Denis-de-Bernardy5 years ago

  • Owner changed from anonymous to josephscott
  • Status changed from reopened to assigned

comment:18 Denis-de-Bernardy5 years ago

  • Status changed from assigned to reviewing

comment:19 hakre5 years ago

  • Keywords tested added; needs-review removed

I see no problem in hotfixing this issue - the overall implementation seems to have bolder design deficiencies anyway so that this patch shouldn't make a difference in terms of breaking things. looks pretty ok to me, tested OK, patch still applies clean.

comment:20 markjaquith4 years ago

  • Milestone changed from 2.9 to Future Release

comment:21 Denis-de-Bernardy4 years ago

  • Milestone changed from Future Release to 3.0

comment:22 nacin4 years ago

  • Keywords close added; pingback xmlrpc.php tested removed
  • Milestone changed from 3.0 to Future Release
Note: See TracTickets for help on using tickets.