Make WordPress Core

Opened 4 years ago

Last modified 6 months ago

#15072 reopened defect (bug)

blogger.getRecentPosts drops backslashes

Reported by: daveabrahams Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 3.1
Component: XML-RPC Keywords: needs-refresh
Focuses: Cc:


I have posts on my site containing fragments like:

[latex]\neg r(a,b)[/latex]

But when I pull them down using emacs weblogger-mode, the backslash is always missing. I edebug'ed way down into the bowels of the code and looked at the raw data arriving in the process buffer, and it was missing the backslash, so I'm pretty certain this is a WP bug and not something in emacs or weblogger-mode. Weblogger-mode is using the blogger API. I tried several other clients, and they seemed to work, but I assume they're using a different protocol (e.g. atom).

Attachments (1)

15072.diff (1.2 KB) - added by mdawaffe 4 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 @josephscott4 years ago

Most XML-RPC clients use the metaWeblog.getRecentPosts method. Does this have the same problem?

comment:2 @daveabrahams4 years ago

  • Cc daveabrahams added

Ha! I didn't think I'd be able to figure out how to test that, but I did, and it works (or at least, doesn't have the backslash problem ;->).

comment:3 @daveabrahams4 years ago

Of course, unless my client is misusing it, the metaWeblog API's "editPost" method doesn't respect the "publish" flag sent as its last parameter. So I have to use blogger's API for that. Kinda weird.

@mdawaffe4 years ago

comment:4 @mdawaffe4 years ago

  • Milestone changed from Awaiting Review to Future Release

Attached removes some useless stripslashes() calls in blogger.getPost and blogger.getRecentPosts.

That said, the 'spec' for those two methods is terrible. Title and categories have to be included in the struct's content parameter, each enclosed in an encoded XML tag. So the title and categories technically should be doubly encoded, but WP doesn't do that, and doing so would probably break any clients that use these methods.

Encourage your client's author to switch to metaWeblog.*

comment:5 @nacin4 years ago

  • Keywords has-patch added

comment:6 @chriscct76 months ago

  • Keywords needs-refresh added; has-patch removed
  • Resolution set to invalid
  • Status changed from new to closed

The function in question now uses unslash instead of stripslashes due to #21767. As such the issue above no longer exists.

comment:7 @mdawaffe6 months ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

wp_unslash() is just a wrapper for stripslashes(). The issue still exists (I just tested to confirm).

If we want to close this ticket as WONTFIX, that's fine with me.

comment:8 @chriscct76 months ago

Ah indeed, mind slipped there for a minute. Unless you think that refreshing the patch to remove the wp_unslash would be a better alternative, wontfix works

Note: See TracTickets for help on using tickets.