WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 2 years ago

Last modified 2 years ago

#38467 closed defect (bug) (wontfix)

XML-RPC: Different type of postid return from getPost and getRecentPosts

Reported by: joshuaavalon Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.6.1
Component: XML-RPC Keywords: has-patch
Focuses: Cc:
PR Number:

Description

metaWeblog.getRecentPosts said to return same struct of metaWeblog.getPost. But the postid is string instead of int.

Attachments (1)

38467.diff (572 bytes) - added by stevenlinx 2 years ago.

Download all attachments as: .zip

Change History (6)

#1 @markoheijnen
3 years ago

Hey Joshua,

Thank you for your first ticket here. I assume you mean https://codex.wordpress.org/XML-RPC_MetaWeblog_API#metaWeblog.getRecentPosts? I just updated the page to reflect your comment.

Anything else that you think that should be addressed within this ticket?

Marko

#2 @joshuaavalon
3 years ago

Will the Api be updated? I am building a program using that Api. The different type makes me not able to reuse the same way to handle the response.

@stevenlinx
2 years ago

#3 @stevenlinx
2 years ago

  • Keywords has-patch added

1.)
@joshuaavalon is right.

metaWeblog.getRecentPosts should return the same struct with the same data type as metaWeblog.getPost. The codex entry for metaWeblog.getRecentPosts says "struct: see #metaWeblog.getPost for fields".

2.)
Once the modified API code is committed, the sentence "Note that the returned postid is string instead of an integer." will need to be removed.

https://codex.wordpress.org/XML-RPC_MetaWeblog_API#metaWeblog.getRecentPosts

From a different perspective, doesn't the lack of such sentence in the original doc implies the two functions share the same data types?

3.)
I've uploaded a patch.

#4 @markoheijnen
2 years ago

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

@stevenlinx Thank you for your patch but I'll have to close this ticket. This is due that API changes like this can't be done without breaking backwards compatibility. As software depends more strictly towards data type, we can't just change it. Sorry I haven't closed this ticket earlier.

Two better alternatives are using the wp.* XML-RPC methods and then we have off course the new REST API.

#5 @netweb
2 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.