Make WordPress Core

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#18869 closed defect (bug) (fixed)

XML-RPC returns wp_author_id as int instead of string

Reported by: yoavf's profile yoavf Owned by: ryan's profile ryan
Milestone: 3.3 Priority: normal
Severity: normal Version: 3.3
Component: XML-RPC Keywords: has-patch
Focuses: Cc:

Description

Following r18597, we now cast the user id to int when initializing the WP_User data.
That value is directly used by the XML-RPC methods to return 'wp_author_id', which is expected to be string.

Patch attached fixes three occurrences -there might be more, and we need to review all the xmlrpc apis that return user ids.

Attachments (1)

18869.diff (1.4 KB) - added by yoavf 12 years ago.

Download all attachments as: .zip

Change History (9)

@yoavf
12 years ago

#1 @yoavf
12 years ago

  • Version set to 3.3

#2 @ryan
12 years ago

This matches what we do with other IDs and has been soaking on wp.com for three weeks.

#3 @ryan
12 years ago

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

In [19071]:

Cast author IDs to strings. Props yoavf. fixes #18869

#4 follow-up: @koke
12 years ago

  • Cc jbernal@… added

I'm a bit late to the party, but documentation says wp_author_id is an int: http://codex.wordpress.org/XML-RPC

But more important, changing XML-RPC data types is the easiest way to break current apps, so please try to avoid it. If you must, please ping the wp-xmlrpc mailing list.

#5 in reply to: ↑ 4 ; follow-up: @SergeyBiryukov
12 years ago

Replying to koke:

I'm a bit late to the party, but documentation says wp_author_id is an int: http://codex.wordpress.org/XML-RPC

Updated Codex page.

#6 in reply to: ↑ 5 ; follow-up: @koke
12 years ago

Replying to SergeyBiryukov:

Updated Codex page.

My point was that the codex said it was an int, so many apps out there would already expect that. Changing it breaks compatibility

#7 in reply to: ↑ 6 @daniloercoli
12 years ago

  • Cc ercoli@… added

Replying to koke:

My point was that the codex said it was an int, so many apps out there would already expect that. Changing it breaks compatibility

You're right, but we need to return wp_author_id as a string, since WP breaks the XML-RPC spec for large user ids.

#8 @westi
12 years ago

Replying to koke:

Replying to SergeyBiryukov:

Updated Codex page.

My point was that the codex said it was an int, so many apps out there would already expect that. Changing it breaks compatibility

I think the codex documentation was incorrect.

I just tested with WordPress 3.3, 3.2, 3.1, 3.0, and 2.9 and we returned a string for wp_author_id when calling wp.getPage.

Note: See TracTickets for help on using tickets.