X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/0461a5f2e55c8d5f1fde96ca2e83117152573c7d..9e77185fafaf4e60e2b73821e0e4b9b1a11fb85f:/wp-includes/kses.php?ds=sidebyside diff --git a/wp-includes/kses.php b/wp-includes/kses.php index 9d8d6fed..0b552955 100644 --- a/wp-includes/kses.php +++ b/wp-includes/kses.php @@ -44,6 +44,10 @@ if ( ! defined( 'CUSTOM_TAGS' ) ) define( 'CUSTOM_TAGS', false ); +// Ensure that these variables are added to the global namespace +// (e.g. if using namespaces / autoload in the current PHP environment). +global $allowedposttags, $allowedtags, $allowedentitynames; + if ( ! CUSTOM_TAGS ) { /** * Kses global for default allowable HTML tags. @@ -987,7 +991,9 @@ function wp_kses_bad_protocol($string, $allowed_protocols) { } /** - * Removes any null characters in $string. + * Removes any invalid control characters in $string. + * + * Also removes any instance of the '\0' string. * * @since 1.0.0 * @@ -995,7 +1001,7 @@ function wp_kses_bad_protocol($string, $allowed_protocols) { * @return string */ function wp_kses_no_null($string) { - $string = preg_replace('/\0+/', '', $string); + $string = preg_replace('/[\x00-\x08\x0B\x0C\x0E-\x1F]/', '', $string); $string = preg_replace('/(\\\\0)+/', '', $string); return $string;