Opened 5 years ago

Closed 5 years ago

#7844 closed defect (bug) (fixed)

WP sends url-encoded text in pingback/trackback

Reported by: reinkim Owned by: anonymous
Priority: normal Milestone: 2.7
Component: General Version: 2.7
Severity: major Keywords: has-patch
Cc:

Description

From [9012], WP sends trackback/pingback using urlencoded text.

[9012] introduces HTTP api to send trackback/pingback. But in this changeset, WP sends blog-title, uri and excerpt in url-encoded format.
So pinged/trackbacked blog displays some strangely formatted trackback like,

blog+title // title
http%3A%2F%2Fexample.org%2F111 // uri
blah+blah+blah+%23%21%40%23%24 // excerpt

This behavior is caused by passing arguments of HTTP api in urlencoded text. (wp-includes/comment.php:1312)

To fix this problem, I've patched current working version of trunk like following diff.

--- comment.php (revision 9098)
+++ comment.php (working copy)
@@ -1310,10 +1310,10 @@
    $options = array();
    $options['timeout'] = 4;
    $options['body'] = array(
-       'title' => urlencode($title),
-       'url' => urlencode(get_permalink($ID)),
-       'blog_name' => urlencode(get_option('blogname')),
-       'excerpt' => urlencode($excerpt)
+       'title' => $title,
+       'url' => get_permalink($ID),
+       'blog_name' => get_option('blogname'),
+       'excerpt' => $excerpt
    );

Attachments (1)

trackback.patch (636 bytes) - added by reinkim 5 years ago.
Patch for wp-includes/comments.php

Download all attachments as: .zip

Change History (6)

  • Keywords trackback,pingback,HTTP api removed
  • Summary changed from WP sends urlencode text in pingback/trackback to WP sends url-encoded text in pingback/trackback

reinkim5 years ago

Patch for wp-includes/comments.php

  • Keywords has-patch added

comment:4   ryan5 years ago

WP_Http::request() calls http_build_query() to encode the request so your patch looks correct.

comment:5   ryan5 years ago

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

(In [9292]) Don't double encode ping/trackbacks. Props reinkim. fixes #7844

Note: See TracTickets for help on using tickets.