[wp-trac] [WordPress Trac] #49905: Correct return type for xmlrpc_getposttitle() and xmlrpc_getpostcategory()

WordPress Trac noreply at wordpress.org
Tue Apr 14 11:33:26 UTC 2020


#49905: Correct return type for xmlrpc_getposttitle() and xmlrpc_getpostcategory()
----------------------------+--------------------
 Reporter:  SergeyBiryukov  |      Owner:  (none)
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  5.5
Component:  XML-RPC         |    Version:
 Severity:  normal          |   Keywords:
  Focuses:                  |
----------------------------+--------------------
 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.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/49905>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list