Opened 20 months ago

Closed 19 months ago

Last modified 17 months ago

#18869 closed defect (bug) (fixed)

XML-RPC returns wp_author_id as int instead of string

Reported by: yoavf Owned by: ryan
Priority: normal Milestone: 3.3
Component: XML-RPC Version: 3.3
Severity: normal Keywords: has-patch
Cc: jbernal@…, ercoli@…

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 20 months ago.

Download all attachments as: .zip

Change History (9)

yoavf20 months ago

  • Version set to 3.3

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

  • 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

comment:4 follow-up: ↓ 5   koke17 months 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.

comment:5 in reply to: ↑ 4 ; follow-up: ↓ 6   SergeyBiryukov17 months 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.

comment:6 in reply to: ↑ 5 ; follow-up: ↓ 7   koke17 months 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

comment:7 in reply to: ↑ 6   daniloercoli17 months 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.

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.