[wp-trac] [WordPress Trac] #28582: Global declaration needed for variables in kses.php

WordPress Trac noreply at wordpress.org
Thu Jun 19 01:55:52 UTC 2014


#28582: Global declaration needed for variables in kses.php
--------------------------+-----------------------------
 Reporter:  Jaza613       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 In 'wp-includes/kses.php', the three variables '$allowedposttags,
 $allowedtags, $allowedentitynames' are declared within an 'if' statement.
 Under normal circumstances, they end up in the global context as they
 should.

 However, if the current PHP environment uses namespaces / autoload, they
 seem to not get added, resulting in this error:

 Warning: in_array() expects parameter 2 to be array, null given in
 /path/to/wp-includes/kses.php line 1176

 (Line 1176 is:)

 {{{
 return ( ( ! in_array($i, $allowedentitynames) ) ? "&$i;" : "&$i;" );
 }}}

 Attached patch fixes the issue, by declaring these variables with the
 'global' keyword before assigning them a value.

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


More information about the wp-trac mailing list