WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#28887 closed defect (bug) (fixed)

Different data type for HTTP response code

Reported by: lonnylot Owned by: dd32
Milestone: 4.1 Priority: normal
Severity: normal Version:
Component: HTTP API Keywords:
Focuses: Cc:

Description

Depending on the transport implementation (cURL or PHP Streams) used when calling wp_remote_get the returned data type for the response code will be different. If cURL is used then it will be an integer. If PHP Streams are used it will be a string. Since the transport implementation is abstracted away it would make it easier if the data types of the returns would also be consistent.

Change History (3)

#1 @dd32
6 years ago

  • Milestone changed from Awaiting Review to 4.1
  • Owner set to dd32
  • Status changed from new to accepted

#2 @dd32
6 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 29849:

Always cast the 'code' server response to an int, this provides consistency between both of the HTTP transports.
Previously cURL would return an int and Streams a numeric string.
Fixes #28887

#3 @johnbillion
5 years ago

In 29985:

Update the docs for wp_remote_retrieve_response_code(). See #28887.

Note: See TracTickets for help on using tickets.