Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#40680 closed enhancement (fixed)

Add support for `'tag' => true` in `wp_kses_attr()`

Reported by: ocean90 Owned by: ocean90
Milestone: 4.8 Priority: normal
Severity: normal Version:
Component: Security Keywords: has-patch has-unit-tests commit
Focuses: Cc:


Related: [meta5483], #20017

wp_kses_attr() uses $allowed_html[strtolower($element)]) == 0 to check whether any attributes are allowed for an element. There's at least one place where true is used to define the support of no attributes. But because count( true ) returns 1 unnecessary checks for the support of attributes are performed.

I don't see anything wrong with using true as an alternative for an empty array and because it's already supported for attributes (#20017) I suggest to add official support for true in wp_kses_attr() as well.

Attachments (1)

40680.patch (1.8 KB) - added by ocean90 3 years ago.

Download all attachments as: .zip

Change History (5)

3 years ago

#1 @ocean90
3 years ago

  • Owner set to dd32
  • Status changed from new to reviewing

@dd32 Do you have any thoughts or objections?

#2 @dd32
3 years ago

  • Owner changed from dd32 to ocean90

I have no objections, seems like a sane thing to do (as I thought it already did work.. :))

#3 @ocean90
3 years ago

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

In 40637:

KSES: Support 'tag' => true as a shorthand for 'tag' => array() in wp_kses_attr().

Automatic_Upgrader_Skin::feedback() had always assumed that this is already the case, now it is.

See #20017.
Fixes #40680.

#4 @ocean90
3 years ago

  • Milestone changed from Future Release to 4.8
Note: See TracTickets for help on using tickets.