WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#10802 closed defect (bug) (fixed)

XMLRPC content_save_pre redundant when calling wp_insert_post

Reported by: redsweater Owned by: josephscott
Milestone: 2.9 Priority: normal
Severity: normal Version: 2.8.4
Component: XML-RPC Keywords: has-patch
Focuses: Cc:

Description (last modified by ryan)

xmlrpc.php currently calls the content_save_pre filter manually on the description of the post, before passing the post content to wp_insert_post.

Since wp_insert_post always calls sanitize_post, and sanitize takes care to call the appropriate filters, including content_save_pre, it is redundant for XMLRPC to manually call them before calling wp_insert_post.

Furthermore, if a filter is installed which has a "non-terminal" filtering effect, the xmlrpc.php redundant filter call causes corruption of post content, by causing the filter to transform the text once as expected, and then transform it again to an unexpected/undesired state.

An example of a plugin that has a non-terminal filter is the popular SyntaxHighlighter Evolved plugin:

http://www.viper007bond.com/wordpress-plugins/syntaxhighlighter/

Users who rely on this plugin currently cannot use remote editors via the XMLRPC interface, because their content gets doubly filtered and turned unreadable.

I am attaching a patch which simple removes the call to the filter in question, counting on the subsequent wp_insert_post to do the sanitizing, and therefore the desired filtering.

Attachments (1)

NoContentFilter.patch (705 bytes) - added by redsweater 5 years ago.

Download all attachments as: .zip

Change History (5)

redsweater5 years ago

comment:1 ryan5 years ago

  • Component changed from General to XML-RPC
  • Description modified (diff)
  • Milestone changed from Unassigned to 2.9
  • Owner set to josephscott

comment:2 ryan5 years ago

Seems good to me. Joseph?

comment:3 josephscott5 years ago

I'm fine with the change. redsweater, thanks for doing the leg work to track this down.

comment:4 ryan5 years ago

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

(In [11942]) Don't run content_save_pre filter twice for XMLRPC posts. Props redsweater. fixes #10802

Note: See TracTickets for help on using tickets.