WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#9068 closed defect (bug) (fixed)

HTTP API Cookies trigger E_NOTICE

Reported by: beaulebens Owned by:
Milestone: 2.8 Priority: low
Severity: minor Version: 2.8
Component: HTTP API Keywords:
Focuses: Cc:

Description

When creating a WP_Http_Cookie using a source array, if you don't set all elements then it generates E_NOTICE errors.

Patch attached checks values before trying to use them.

Attachments (3)

cookie-notices.diff (989 bytes) - added by beaulebens 6 years ago.
9068.sivel.diff (527 bytes) - added by sivel 6 years ago.
cookies_check.9068.diff (640 bytes) - added by filosofo 6 years ago.

Download all attachments as: .zip

Change History (12)

@beaulebens6 years ago

comment:1 @azaozz6 years ago

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

(In [10524]) Fix PHP notices in HTTP API Cookies, props beaulebens, fixes #9068

comment:2 @westi6 years ago

  • Version set to 2.8

comment:3 @sivel6 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:4 @sivel6 years ago

Update for one additional place in the HTTP API that causes notice in new cookies functionality.

@sivel6 years ago

comment:5 @ryan6 years ago

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

(In [10633]) Fix notice. Props sivel. fixes #9068

comment:6 follow-up: @aaroncampbell6 years ago

Is there a reason that we couldn't use empty() in [10633] rather than isset() and count()?

comment:7 @filosofo6 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Also should probably cast cookies to array. Patch attached.

comment:8 in reply to: ↑ 6 @sivel6 years ago

Replying to aaroncampbell:

Is there a reason that we couldn't use empty() in [10633] rather than isset() and count()?

That does sound better. I guess I should have looked closer at what the code was doing rather than just a way to stop the notice.

comment:9 @westi6 years ago

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

(In [10639]) Better Notice fixing and place a protective cast in the cookie handler. Fixes #9068 props filosofo.

Note: See TracTickets for help on using tickets.