WordPress.org

Make WordPress Core

Opened 5 months ago

Closed 3 months ago

#50962 closed defect (bug) (wontfix)

WP_HTTP_Response should have protected properties

Reported by: daniel217 Owned by:
Milestone: Priority: normal
Severity: trivial Version: 4.4
Component: REST API Keywords: close
Focuses: rest-api Cc:

Description

I think this is a bug because there is a getter / setter for these properties:

$data - get_data(), set_data( $data )
$status - get_status (), set_status ( $code )
$headers - get_headers(), set_headers( $headers ), header( $key, $value, $replace )

Change History (2)

#1 @TimothyBlynJacobs
5 months ago

  • Component changed from HTTP API to REST API
  • Focuses privacy coding-standards removed
  • Keywords close added
  • Version changed from 5.5 to 4.4

Thanks for the ticket @daniel217 and welcome to trac!

From my perspective, I agree that it would be better for these to be protected properties. But unfortunately I don’t think it would be possible to change that at this point without breaking backward compatibility. I’ve seen plenty of plugins that do set those properties manually.

We could change it to protected and implement __get, but I don’t think we get much benefit at that point.

#2 @TimothyBlynJacobs
3 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

I'm going to go ahead and close this @daniel217. Like I explained in my previous comment, I would've preferred it to have that format but I think it is too late to do so without introducing BC concerns.

Note: See TracTickets for help on using tickets.