WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#13098 closed defect (bug) (fixed)

sanitize_bookmark_field() assumes link_category is an array

Reported by: mdawaffe Owned by:
Milestone: 3.0 Priority: normal
Severity: minor Version: 3.0
Component: General Keywords: warning, optimization
Focuses: Cc:

Description

A link object's link_category property is an array of the link category ids to which the link belongs. In rare circumstances, though, it can be set to a scalar.

Attached casts the link_category value to an array before calling array_map(). This avoids a PHP warning.

Patch also optimizes the conditional logic a bit by turning the series of $field if statements into a single switch statement and by moving the esc_attr/esc_js logic into the only $context branch to which it applies.

Attachments (1)

13098.diff (1.8 KB) - added by mdawaffe 4 years ago.

Download all attachments as: .zip

Change History (5)

mdawaffe4 years ago

comment:1 ryan4 years ago

  • Milestone changed from Unassigned to 3.0

comment:2 ryan4 years ago

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

(In [14239]) Fix array handling in sanitize_bookmark_field(). Props mdawaffe. fixes #13098

comment:3 nacin4 years ago

Related, maybe duplicate (see comments on dbDelta): #12854.

comment:4 wet4 years ago

  • Cc r.wetzlmayr@… added
Note: See TracTickets for help on using tickets.