WordPress.org

Make WordPress Core

Opened 16 months ago

Last modified 8 weeks ago

#49905 accepted defect (bug)

Correct return type for xmlrpc_getposttitle() and xmlrpc_getpostcategory()

Reported by: SergeyBiryukov Owned by: SergeyBiryukov
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: XML-RPC Keywords: has-patch
Focuses: Cc:

Description

There are a few issues in xmlrpc_getposttitle() and xmlrpc_getpostcategory():

  • xmlrpc_getposttitle() uses the $post_default_title global as a fallback title, however the global is only set in xmlrpc.php and not in other contexts where the function might be called, e.g. wp-mail.php. In those cases, the function returns null instead of a string, causing issues like #49853.
  • xmlrpc_getpostcategory() uses the $post_default_category global, however it was removed in [2680]. Because of that, the function can also return null.
  • xmlrpc_getpostcategory() documentation suggests that it returns either a string or an array of strings, however that is incorrect. It's supposed to be used for the post_category parameter of wp_insert_post(), which receives an array of numeric category IDs.

Let's bring some consistency and unit tests here.

Attachments (1)

49905.diff (3.8 KB) - added by SergeyBiryukov 16 months ago.

Download all attachments as: .zip

Change History (14)

#2 @Presskopp
14 months ago

  • Keywords has-patch added

#3 @SergeyBiryukov
13 months ago

  • Milestone changed from 5.5 to 5.6

This ticket was mentioned in Slack in #core by hellofromtonya. View the logs.


9 months ago

#5 @SergeyBiryukov
9 months ago

  • Owner set to SergeyBiryukov
  • Status changed from new to accepted

#6 @whyisjake
9 months ago

In 49376:

XML-RPC: Return error message if attachment ID is incorrect.

Throw an error for incorrect attachment IDs when requesting a media object to ensure return signature is correct and doesn't include incorrectly typed values within the object.

Props zieladam, peterwilsoncc, whyisjake.
See #49905.

#7 @desrosj
9 months ago

In 49385:

XML-RPC: Return error message if attachment ID is incorrect.

Throw an error for incorrect attachment IDs when requesting a media object to ensure return signature is correct and doesn't include incorrectly typed values within the object.

Props zieladam, peterwilsoncc, whyisjake.
Merges [49376] to trunk.
See #49905.

This ticket was mentioned in Slack in #core by helen. View the logs.


9 months ago

#9 @SergeyBiryukov
9 months ago

  • Milestone changed from 5.6 to 5.7

#10 @lukecarbis
5 months ago

  • Milestone changed from 5.7 to 5.8

This ticket was mentioned in Slack in #core by chaion07. View the logs.


8 weeks ago

#12 @chaion07
8 weeks ago

Upon reviewing this ticket during a [recent triage session]https://wordpress.slack.com/archives/C02RQBWTW/p1622577686161800 the team recommended that this can be punted for future release (not 5.9). Thanks

Last edited 8 weeks ago by chaion07 (previous) (diff)

#13 @JeffPaul
8 weeks ago

  • Milestone changed from 5.8 to Future Release
Note: See TracTickets for help on using tickets.