WordPress.org

Make WordPress Core

Opened 13 years ago

Closed 3 years ago

Last modified 3 years ago

#3052 closed defect (bug) (invalid)

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

Reported by: webrocker Owned by: josephscott
Milestone: Priority: normal
Severity: normal Version: 2.0.4
Component: Pings/Trackbacks Keywords: needs-patch needs-testing
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 13 years ago.
pingback_ping function patched on line 1192
xmlrpc.php.diff (646 bytes) - added by webrocker 13 years ago.
3052.diff (704 bytes) - added by Denis-de-Bernardy 10 years ago.
original patch, refreshed

Download all attachments as: .zip

Change History (29)

#1 @Webrocker
13 years ago

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

#2 @Webrocker
13 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. (...)

#3 @webrocker
13 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.

#4 @webrocker
13 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.

#5 @webrocker
13 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?

#6 @foolswisdom
13 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.

@webrocker
13 years ago

pingback_ping function patched on line 1192

#7 @webrocker
13 years ago

  • Keywords patch|2nd opinion added; fix removed

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

#8 @foolswisdom
13 years ago

  • Milestone set to 2.1

#9 @matt
13 years ago

  • Milestone changed from 2.1 to 2.2

#10 @foolswisdom
12 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

#11 @foolswisdom
12 years ago

  • Milestone changed from 2.3 to 2.5

#12 @josephscott
12 years ago

  • Cc josephscott added

#13 @Denis-de-Bernardy
10 years ago

still current?

#14 @Denis-de-Bernardy
10 years ago

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

this has been rotting for long enough

#15 @Denis-de-Bernardy
10 years ago

  • Milestone 2.9 deleted

@Denis-de-Bernardy
10 years ago

original patch, refreshed

#16 @Denis-de-Bernardy
10 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

#17 @Denis-de-Bernardy
10 years ago

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

#18 @Denis-de-Bernardy
10 years ago

  • Status changed from assigned to reviewing

#19 @hakre
10 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.

#20 @markjaquith
10 years ago

  • Milestone changed from 2.9 to Future Release

#21 @Denis-de-Bernardy
10 years ago

  • Milestone changed from Future Release to 3.0

#22 @nacin
9 years ago

  • Keywords close added; pingback xmlrpc.php tested removed
  • Milestone changed from 3.0 to Future Release

#23 @markoheijnen
5 years ago

  • Keywords needs-patch added; has-patch removed

Unsure what to do with this ticket. Fix looks easy but not touched for years. Fine with closing.

Last edited 5 years ago by markoheijnen (previous) (diff)

#24 @atomicjack
4 years ago

  • Keywords needs-testing added; close removed

Is this still an issue? If so, let's get it fixed.

#25 @dshanske
3 years ago

  • Component changed from XML-RPC to Pings/Trackbacks
  • Resolution set to invalid
  • Status changed from reviewing to closed

Suggesting that the code for generating the excerpt itself should be refreshed, and I'm suggesting this be closed in favor of a refresh on that.

The code on this would also need to be refreshed due changes in the function.

#26 @netweb
3 years ago

  • Milestone Future Release deleted
Note: See TracTickets for help on using tickets.