[wp-trac] [WordPress Trac] #40838: REST API: Inconsistent parameter type handling in `set_param()`
WordPress Trac
noreply at wordpress.org
Sat Mar 7 21:50:10 UTC 2020
#40838: REST API: Inconsistent parameter type handling in `set_param()`
-------------------------------------------------+-------------------------
Reporter: jnylen0 | Owner: vagios
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: Future
| Release
Component: REST API | Version: 4.4
Severity: minor | Resolution:
Keywords: good-first-bug needs-unit-tests | Focuses: rest-api
needs-patch |
-------------------------------------------------+-------------------------
Comment (by mnelson4):
> Looking at the patch again, I think we'd want to stop after updating the
parameter for the first parameter type instead of overwriting it for all
types. That way we retain as much of the original semantics of the request
as possible.
It only overwrites types where it was set. `set_param` is vague as to
which type you're setting, so I think it's appropriate to overwrite it for
each that's previously set it.
Eg, if `foo` is set in the body and GET parameters, calling
`$request->set_param('foo','new_value');` will only overwrite it in the
body and GET parameters, but none of the others.
> I also wonder if we need to skip checking the defaults parameter type.
Agreed, the PR https://github.com/WordPress/wordpress-develop/pull/181
does that.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/40838#comment:14>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list