Make WordPress Core

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#5552 closed defect (bug) (worksforme)

XMLRPC erroneously adds smart quotes to category names

Reported by: redsweater Owned by: josephscott
Milestone: Priority: normal
Severity: normal Version: 2.3.2
Component: XML-RPC Keywords:
Focuses: Cc:


If a category contains a single-quote character ('), then its value is mis-reported in the response to metaWebog.getPost. The value is "smartened" into a right quote entity. For instance, add a category to a post, with the name "Won't Work" (use a single-quote, not a right-apostrophe, in case this content I'm typing gets smartened by Trac).

Then, when you do a metaWeblog.getPost, or a mt.getPostCategories, you will find the results erroneously "smartened", even though the value of the category name in the database is in fact still just a single ASCII-compatible quote tick:

<member><name>categories</name><value><array><data> <value><string>Won&amp;#8217;t Work</string></value> </data></array></value></member>

This is problematic, because the name of the category reported here doesn't match the name of the category as reported, for instance, by wp.getCategories:

<value><struct> <member><name>categoryId</name><value><string>17</string></value></member> <member><name>parentId</name><value><string>0</string></value></member> <member><name>description</name><value><string>Won't Work</string></value></member> <member><name>categoryName</name><value><string>Won't Work</string></value></member> <member><name>htmlUrl</name><value><string></string></value></member> <member><name>rssUrl</name><value><string>;amp;cat=17</string></value></member>


If some kind of "smartening" is to be done, it should be in the "description" field of the getCategories response. The category name as identified in the other fields should strictly match the categoryName attribute as reported by getCategories.

This causes problems if the weblog client makes assumptions about the name of a category in a post matching what its name is listed as in the getCategories response.

I don't think the content should be smartened except in the "description" field, but if you disagree I hope you'll at least consider making the "name" consistent across getCategories and the other XMLRPC methods.

Change History (3)

#1 @josephscott
10 years ago

  • Cc josephscott added

I've been trying to reproduce this against -trunk and have been unsuccessful thus far. I created a category T`est'Na"me (back tick, single quote, double quote) and when I when I call metaWeblog.getPost, mt.getPostCategories or metaWeblog.getCategories I get:


sent back, which is what I'd expect.

What version of WordPress are you seeing this on?

#2 @redsweater
10 years ago

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

Thanks a lot for looking into this, Joseph. I can't reproduce on either trunk or 2.3.2 now. So perhaps I was misunderstanding something else that was going on, or was testing against 2.3.1 and this got magically (?) fixed in 2.3.2?

In any case I think you can close it.

#3 @Nazgul
10 years ago

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