[wp-trac] [WordPress Trac] #52956: WP_REST_Request->get_params() doesn't correctly handle boolean false
WordPress Trac
noreply at wordpress.org
Wed Mar 31 22:32:30 UTC 2021
#52956: WP_REST_Request->get_params() doesn't correctly handle boolean false
--------------------------+-----------------------------
Reporter: ivankk | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
When I use [https://developer.wordpress.org/block-editor/reference-
guides/packages/packages-url/#addQueryArgs addQueryArg] with a false
value, it's not interpreted as false by
[https://developer.wordpress.org/reference/classes/wp_rest_request/get_params/
WP_Rest_Request->get_params()]
{{{
wp.url.addQueryArgs( 'endpoint', { foo: false } );
}}}
will give us ''endpoint?foo=false'' which rest_route callback
''$request->get_params();''
Will treat as {{{array( 'foo' => 'false' );}}}
This arises as there's no standard for encoding a boolean in a query
string.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/52956>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list