Opened 3 years ago
Closed 3 years ago
#55130 closed defect (bug) (invalid)
Invalid syntax to access object keys
Reported by: | mmaattiiaass | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 5.9 |
Component: | REST API | Keywords: | has-patch |
Focuses: | rest-api | Cc: |
Description
In the prepare_item_for_database method of the WP_REST_Global_Styles_Controller class we are treating the $request variable as an array when it is an object, so we need to change the way we access their properties.
Example:
$request->styles
instead of
$request['styles']
Change History (3)
This ticket was mentioned in PR #2298 on WordPress/wordpress-develop by matiasbenedetto.
3 years ago
#2
- Keywords has-patch added
#3
@
3 years ago
- Milestone 5.9.1 deleted
- Resolution set to invalid
- Status changed from new to closed
Welcome to trac @mmaattiiaass and thanks for the ticket!
The WP_REST_Request
object implements ArrayAccess
so this syntax is correct and intentionally how we want to access request data. See the developer docs for more details.
Note: See
TracTickets for help on using
tickets.
We are treating the $request variable as an array when it is an object, so we need to change the way we access their properties.
Trac ticket:
https://core.trac.wordpress.org/ticket/55130#ticket