#20394 closed defect (bug) (fixed)
XMLRPC: notices for missing arguments
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 3.4 |
| Component: | XML-RPC | Version: | 3.4 |
| Severity: | normal | Keywords: | has-patch dev-feedback |
| Cc: | markoheijnen, max@… |
Description
When arguments aren't pass there is a big chance a notice get fired.
When someone uses WP_Debug this can mean the XMLRPC will break
Attachments (4)
Change History (15)
markoheijnen — 14 months ago
I wonder if that patch is really the right approach.
It might be better to have a guard condition at the top of each method that checks that $args is at least a minimum length. And if the guard fails, return a 400 status code error.
Sensible error messages help API consumers as well as prevent these PHP notices.
comment:3
markoheijnen — 14 months ago
Was first thinking about that. Looking into the code I think for all methods it should work. Probably some need discussion.
One issue need to be fixed and that is in wp_editPost. $post_more isn't set what causes a notice
comment:4
markoheijnen — 14 months ago
This is a first rough version of the guard condition version. A lot of unit test will fail since they also test if there are nog enough arguments passed.
I could go for 20394.guard.diff but we should enforce this for new methods only.
Added a refreshed patch that makes the method name a bit friendly and only applies to methods added in 3.4 for back-compat. I'm not sure whether we should make it cover the other wp.* methods, but at least we should avoid adding it to the legacy method namespaces.
- Owner set to nacin
- Resolution set to fixed
- Status changed from new to closed
In [20636]:
- Resolution fixed deleted
- Status changed from closed to reopened
The patch, used spaces instead of tabs, and 4 spaces at that. I happened to notice that as a result the code looked poorly formatted with a config using an 8 space tab.
Upcoming patch switches to tabs instead of spaces.
comment:10
nacin — 13 months ago
- Resolution set to fixed
- Status changed from reopened to closed
In [20703]:
comment:11
nacin — 13 months ago
Of course, we indent with tabs, not spaces.

$args checks changes for all the XMLRPC methods