Opened 12 hours ago
Last modified 12 hours ago
#49905 new defect (bug)
Correct return type for xmlrpc_getposttitle() and xmlrpc_getpostcategory()
Reported by: | SergeyBiryukov | Owned by: | |
---|---|---|---|
Milestone: | 5.5 | Priority: | normal |
Severity: | normal | Version: | |
Component: | XML-RPC | Keywords: | |
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 inxmlrpc.php
and not in other contexts where the function might be called, e.g.wp-mail.php
. In those cases, the function returnsnull
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 returnnull
.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 thepost_category
parameter ofwp_insert_post()
, which receives an array of numeric category IDs.
Let's bring some consistency and unit tests here.
Attachments (1)
Note: See
TracTickets for help on using
tickets.
Related: #37096