From a0aa608970a610a200b6bcdc1b478716778615db Mon Sep 17 00:00:00 2001 From: Drew Jaynes Date: Tue, 23 Feb 2016 16:57:26 +0000 Subject: [PATCH] Docs: Improve documentation for `WP_REST_Request` to highlight a caveat of ArrayAccess when it comes to passing similar arguments for multiple request methods. Props danielbachhuber, DrewAPicture. Fixes #35799. Built from https://develop.svn.wordpress.org/trunk@36636 git-svn-id: http://core.svn.wordpress.org/trunk@36603 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/rest-api/class-wp-rest-request.php | 7 +++++++ wp-includes/version.php | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/wp-includes/rest-api/class-wp-rest-request.php b/wp-includes/rest-api/class-wp-rest-request.php index 4d4936b5f0..d2fbe24109 100644 --- a/wp-includes/rest-api/class-wp-rest-request.php +++ b/wp-includes/rest-api/class-wp-rest-request.php @@ -16,6 +16,13 @@ * used in that manner. It does not use ArrayObject (as we cannot rely on SPL), * so be aware it may have non-array behaviour in some cases. * + * Note: When using features provided by ArrayAccess, be aware that WordPress deliberately + * does not distinguish between arguments of the same name for different request methods. + * For instance, in a request with `GET id=1` and `POST id=2`, `$request['id']` will equal + * 2 (`POST`) not 1 (`GET`). For more precision between request methods, use + * {@see WP_REST_Request::get_body_params()}, {@see WP_REST_Request::get_url_params()}, + * etc. + * * @since 4.4.0 * * @see ArrayAccess diff --git a/wp-includes/version.php b/wp-includes/version.php index fdb239b412..0d59ceafa9 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.5-alpha-36635'; +$wp_version = '4.5-alpha-36636'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.