WordPress.org

Make WordPress Core

Opened 14 months ago

Closed 14 months ago

Last modified 14 months ago

#44549 closed defect (bug) (invalid)

Error : [] operator not supported for strings

Reported by: conner_bw Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.9.7
Component: General Keywords:
Focuses: Cc:

Description

This function:

function wp_kses_post( $data ) {
        return wp_kses( $data, 'post' );
}

https://github.com/WordPress/wordpress-develop/blob/169f2a432dcb000ccee0d14c50b76a62218115b3/src/wp-includes/kses.php#L1575

Doesn't work because the second parameter is a string but wp_kses() expects an array.

 * @param string $string            Content to filter through kses
 * @param array  $allowed_html      List of allowed HTML elements
 * @param array  $allowed_protocols Optional. Allowed protocol in links.
 * @return string Filtered content with only allowed HTML elements
 */
function wp_kses( $string, $allowed_html, $allowed_protocols = array() ) {

https://github.com/WordPress/wordpress-develop/blob/169f2a432dcb000ccee0d14c50b76a62218115b3/src/wp-includes/kses.php#L526

We get:

Error : [] operator not supported for strings
 /tmp/wordpress/wp-includes/plugin.php:195
 /tmp/wordpress/wp-includes/kses.php:688
 /tmp/wordpress/wp-includes/kses.php:531
 /tmp/wordpress/wp-includes/kses.php:1576

Change History (2)

#1 @conner_bw
14 months ago

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

No bug.

Unit test out of order, didn't init $wp_current_filter correctly.

Last edited 14 months ago by conner_bw (previous) (diff)

#2 @netweb
14 months ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.