Make WordPress Core

Opened 15 years ago

Closed 15 years ago

#7794 closed defect (bug) (fixed)

Got and fixed an error 'faultCode -32700 faultString parse error. not well formed' on XMLRPC request.

Reported by: minor's profile Minor Owned by:
Milestone: 2.8 Priority: high
Severity: major Version: 2.6
Component: XML-RPC Keywords: reporter-feedback has-patch
Focuses: Cc:

Description

I've worked with XML-RPC requests and founded that some of my requests got this error. As I'm a developer - it's my work to repair the bugs.

I've founded the bug in the 'wp-includes/class-IXR.php' file. There is a problem in the 157 string (Class IXR_Message, function parse, string 2). Here it is.

'$this->message = preg_replace('/<\?xml(.*)?\?'.'>/', , $this->message);'

$this->message value before this string was correct but after preg_replace it's value sometimes became NULL.

There is a topics where this problem is discussed.

http://bugs.php.net/bug.php?id=40961&thanks=6

http://bugs.php.net/bug.php?id=41580

I've founded a solution to fix that. Change that string to

'$this->message = preg_replace('/<\?xml.*?\?'.'>/', , $this->message);'

( only round brackets were deleted).

I've founded and fixed this bug on the WP 2.6 - 2.6.2 on PHP 5.2.6 (Linuks) and 5.2.4 (Windows).

Attachments (1)

wp-includes--class-IXR.php.diff (534 bytes) - added by josephscott 15 years ago.

Download all attachments as: .zip

Change History (6)

#1 @josephscott
15 years ago

  • Cc josephscott added

I haven't run into this before. I'd like to get more info on this before changing a regex that seems to have been working pretty well so far. At a minimum I want to be able reproduce the problem.

Can you provide the raw XML (with username/passwords removed) for before and after the regex, along with the final raw XML-RPC response.

#2 @westi
15 years ago

  • Cc westi added
  • Keywords reporter-feedback added

#3 @jacobsantos
15 years ago

  • Keywords needs-patch added

#4 @josephscott
15 years ago

  • Keywords has-patch added; needs-patch removed

I was able to come up with a test case where I could reliably fix the problem. Confirmed that removing the capturing parens fixed the problem. So I've included a patch that takes care of that. I'm also going to try and get the accepted upstream.

#5 @azaozz
15 years ago

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

(In [10318]) Fix parse error.not well formed on XMLRPC request, props josephscott, fixes #7794

Note: See TracTickets for help on using tickets.