[wp-trac] [WordPress Trac] #44549: Error : [] operator not supported for strings

WordPress Trac noreply at wordpress.org
Mon Jul 9 17:24:17 UTC 2018


#44549: Error : [] operator not supported for strings
--------------------------+-----------------------------
 Reporter:  conner_bw     |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  4.9.7
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 This function:

 {{{#!php
 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.

 {{{#!php
  * @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
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44549>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list