Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#33995 closed task (blessed) (fixed)

Clarify the expected return values of the pre_http_request filter

Reported by: johnbillion's profile johnbillion Owned by: drewapicture's profile DrewAPicture
Milestone: 4.4 Priority: normal
Severity: normal Version:
Component: HTTP API Keywords: has-patch
Focuses: docs Cc:

Description

I've seen several instances where the pre_http_request filter is used, and its return value is set to something other than a WP_Error or an array that looks like an HTTP API response. Returning such values (for example, boolean true) results in unexpected behaviour, so the documentation should be updated to clarify this.

Attachments (1)

33995.patch (1.5 KB) - added by johnbillion 9 years ago.

Download all attachments as: .zip

Change History (3)

@johnbillion
9 years ago

#1 @johnbillion
9 years ago

  • Keywords has-patch added

#2 @DrewAPicture
9 years ago

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

In 34509:

Docs: Improve the summary and description for the pre_http_request filter docs to better illustrate expected values.

The filter explicitly expects one of three passed value types:

  • An array containing 'headers', 'body', 'response', 'cookies', and 'filename' elements
  • A WP_Error instance
  • Boolean false (to avoid short-circuiting the response)

Props johnbillion.
Fixes #33995.

Note: See TracTickets for help on using tickets.