WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 21 months ago

#25179 closed defect (bug) (fixed)

New required parameter added to WP_Http::processHeaders can cause warnings

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

Description

3.7 only bug (so does not involve stable)

I noticed that a new required parameter was added to WP_Http::processHeaders in [25044] by @dd32.

The problem is, if something was using this function (which is a public member) then you'll get a warning like:

Warning: Missing argument 2 for WP_Http::processHeaders()

I've since patched my code to pass the $url - but since this function has been around since 2.7 I'm guessing other code out there will hit that warning.

Change History (4)

comment:1 follow-up: @dd322 years ago

  • Component changed from General to HTTP
  • Milestone changed from Awaiting Review to 3.7
  • Version set to trunk

Indeed it should probably be marked optional if anyone else is using it

Curious though, Why/how are you using this method? It's only really public because of the architecture of WP_HTTP requires it to be a public method.

comment:2 in reply to: ↑ 1 @jshreve2 years ago

Curious though, Why/how are you using this method? It's only really public because of the architecture of WP_HTTP requires it to be a public method.

I actually wasn't using it personally. The Jetpack server code uses it mixed with some CURL stuff and some signature writing stuff. It does it instead of straight WP_Http. The comment says "so it can do 'mulitpart/form-data requests". Again, that's all going based on comments in the source code :) - I was just fixing a warning I saw and figured someone else, somewhere might also be using the function.

comment:3 @dd322 years ago

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

In 25176:

WP_HTTP: Make the new 2nd parameter to WP_HTP::processHeaders() as optional. See #21182. Fixes #25179

comment:4 @SergeyBiryukov21 months ago

  • Version changed from trunk to 3.7
Note: See TracTickets for help on using tickets.