Make WordPress Core

Changeset 36636


Ignore:
Timestamp:
02/23/2016 04:56:28 PM (9 years ago)
Author:
DrewAPicture
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/class-wp-rest-request.php

    r35890 r36636  
    1616 * used in that manner. It does not use ArrayObject (as we cannot rely on SPL),
    1717 * so be aware it may have non-array behaviour in some cases.
     18 *
     19 * Note: When using features provided by ArrayAccess, be aware that WordPress deliberately
     20 * does not distinguish between arguments of the same name for different request methods.
     21 * For instance, in a request with `GET id=1` and `POST id=2`, `$request['id']` will equal
     22 * 2 (`POST`) not 1 (`GET`). For more precision between request methods, use
     23 * {@see WP_REST_Request::get_body_params()}, {@see WP_REST_Request::get_url_params()},
     24 * etc.
    1825 *
    1926 * @since 4.4.0
Note: See TracChangeset for help on using the changeset viewer.