Make WordPress Core

Opened 11 years ago

Last modified 37 hours ago

#33940 assigned defect (bug)

Double spaces in term names can cause problems

Reported by: smerriman's profile smerriman Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: XML-RPC Keywords: needs-patch
Focuses: Cc:

Description

Create a tag called 'test term'.

Use XML-RPC to create a post with a tag of:

test  term

(two spaces). You'll get an error thrown, with the post not created:

A term with the name already exists in this taxonomy

This appears to be due to the _insert_post function in XML-RPC using get_term_by( 'name', $term_name, $taxonomy );, which is returning false - thus it tries to create the term as new, and fails.

Most other aspects of WP seem to filter the term name to strip double spaces first - is that what is necessary here? Or could the issue affect more than just XML-RPC?

Change History (7)

#1 @wonderboymusic
11 years ago

  • Owner set to boonebgorges
  • Status changed from new to assigned

#2 @obenland
11 years ago

  • Version trunk deleted

#3 @desrosj
8 years ago

  • Keywords needs-patch added

#4 @desrosj
7 years ago

@boonebgorges Do you have any interest in working this one?

#5 @boonebgorges
7 years ago

  • Owner boonebgorges deleted

No :) I'd be happy to review a patch if someone wants to dig into the root cause.

#6 @andraganescu
7 years ago

Hey there,

To make creating a patch easier it’d be good to have a unit test showing the problem.This test file tests/phpunit/tests/xmlrpc/wp/newPost.php has examples of creating posts with terms.

#7 @shreya0shrivastava
37 hours ago

Tested on WordPress 7.1-alpha-62161-src — this bug no longer reproduces.

Reproduction steps taken:

  1. Created a post_tag term test term (single space) via wp_insert_term()
  2. Loaded all IXR dependencies via glob( ABSPATH . 'wp-includes/IXR/class-IXR-*.php' )
  3. Instantiated wp_xmlrpc_server directly
  4. Called wp_newPost() with terms_names => [ 'post_tag' => ['test term'] ] (double space)

Post was created successfully with a post ID returned — no A term with the name already exists error thrown.

Note: See TracTickets for help on using tickets.