Make WordPress Core

Opened 8 years ago

Closed 7 years ago

#41759 closed enhancement (fixed)

WP_HTTP_Response: Use setter instead of directly accessing the $data property

Reported by: tfrommen's profile tfrommen Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 4.9 Priority: normal
Severity: normal Version: 4.4
Component: HTTP API Keywords: has-patch commit
Focuses: rest-api Cc:

Description

The constructor of the WP_HTTP_Response class (and thus also WP_REST_Response) has three arguments: $data, $status and $headers.

While there is a dedicated setter for each of the three properties, $data is set directly.

In order to enable people to rely on inheritane and automatically use overwritten methods, let's use the setter, please.

Patch will follow soonish.

Attachments (1)

41759.patch (641 bytes) - added by tfrommen 8 years ago.

Download all attachments as: .zip

Change History (7)

@tfrommen
8 years ago

#1 @tfrommen
8 years ago

  • Keywords has-patch added

#2 @rmccue
8 years ago

  • Focuses rest-api added
  • Keywords commit added
  • Milestone changed from Awaiting Review to 4.9
  • Version set to 4.4

This ticket was mentioned in Slack in #core by jeffpaul. View the logs.


7 years ago

This ticket was mentioned in Slack in #core by jeffpaul. View the logs.


7 years ago

This ticket was mentioned in Slack in #core-restapi by tfrommen. View the logs.


7 years ago

#6 @SergeyBiryukov
7 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 41707:

HTTP API: Use WP_HTTP_Response::set_data() in ::__construct() instead of directly accessing the $data property.

Props tfrommen.
Fixes #41759.

Note: See TracTickets for help on using tickets.