XML-RPC: Fatal TypeError when the fields argument is not an array - #13299
XML-RPC: Fatal TypeError when the fields argument is not an array#13299josephscott wants to merge 3 commits into
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Co-authored-by: Weston Ruter <westonruter@gmail.com>
Co-authored-by: Weston Ruter <westonruter@gmail.com>
|
Confirming that the tests are “load bearing” when run against |
Ten `wp.*` methods accept an optional `$fields` argument from the client and pass it straight through to the `_prepare_*()` helpers, where `in_array()` raises a fatal `TypeError` as soon as the value is not an array. A new `wp_xmlrpc_server::_is_fields_array()` helper now checks the argument up front, so a malformed request returns a 400 `IXR_Error` to the client instead of taking the request down with a fatal error. The affected methods are `wp.getPost`, `wp.getPosts`, `wp.getTaxonomy`, `wp.getTaxonomies`, `wp.getUser`, `wp.getUsers`, `wp.getProfile`, `wp.getPostType`, `wp.getPostTypes`, and `wp.getRevisions`. Unit tests covering each of them are included, along with the `@since` entries that were missing from `wp_getUser()`, `wp_getUsers()`, and `wp_getProfile()`. Developed in #13299. Props josephscott, westonruter. Fixes #65983. git-svn-id: https://develop.svn.wordpress.org/trunk@63393 602fd350-edb4-49c9-b593-d223f7449a82
Ten `wp.*` methods accept an optional `$fields` argument from the client and pass it straight through to the `_prepare_*()` helpers, where `in_array()` raises a fatal `TypeError` as soon as the value is not an array. A new `wp_xmlrpc_server::_is_fields_array()` helper now checks the argument up front, so a malformed request returns a 400 `IXR_Error` to the client instead of taking the request down with a fatal error. The affected methods are `wp.getPost`, `wp.getPosts`, `wp.getTaxonomy`, `wp.getTaxonomies`, `wp.getUser`, `wp.getUsers`, `wp.getProfile`, `wp.getPostType`, `wp.getPostTypes`, and `wp.getRevisions`. Unit tests covering each of them are included, along with the `@since` entries that were missing from `wp_getUser()`, `wp_getUsers()`, and `wp_getProfile()`. Developed in WordPress/wordpress-develop#13299. Props josephscott, westonruter. Fixes #65983. Built from https://develop.svn.wordpress.org/trunk@63393 git-svn-id: http://core.svn.wordpress.org/trunk@62586 1a063a9b-81f0-0310-95a4-ce76da25c4cd
https://core.trac.wordpress.org/ticket/65983
AI assistance: Yes
Tool(s): Claude
Model(s): Fable 5
Used for: It wrote the tests.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.