WordPress.org

Make WordPress Core


Ignore:
Timestamp:
11/21/2021 05:15:26 PM (2 weeks ago)
Author:
SergeyBiryukov
Message:

KSES: Use correct global in wp_kses_xml_named_entities().

This fixes a discrepancy where the the global name used in the function did not match the one declared at the beginning of kses.php, and ensures that the function gets the correct array of allowed XML entity names.

Includes unit tests.

Follow-up to [48072].

Props ovidiul, costdev, peterwilsoncc, SergeyBiryukov.
Fixes #54060.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/kses.php

    r52128 r52229  
    460460
    461461    /**
    462      * @var string[] $allowedentitynames Array of KSES allowed HTML entitity names.
     462     * @var string[] $allowedentitynames Array of KSES allowed HTML entity names.
    463463     * @since 1.0.0
    464464     */
     
    720720
    721721    /**
    722      * @var string[] $allowedxmlentitynames Array of KSES allowed XML entitity names.
     722     * @var string[] $allowedxmlentitynames Array of KSES allowed XML entity names.
    723723     * @since 5.5.0
    724724     */
    725     $allowedxmlnamedentities = array(
     725    $allowedxmlentitynames = array(
    726726        'amp',
    727727        'lt',
     
    19071907 */
    19081908function wp_kses_xml_named_entities( $matches ) {
    1909     global $allowedentitynames, $allowedxmlnamedentities;
     1909    global $allowedentitynames, $allowedxmlentitynames;
    19101910
    19111911    if ( empty( $matches[1] ) ) {
     
    19151915    $i = $matches[1];
    19161916
    1917     if ( in_array( $i, $allowedxmlnamedentities, true ) ) {
     1917    if ( in_array( $i, $allowedxmlentitynames, true ) ) {
    19181918        return "&$i;";
    19191919    } elseif ( in_array( $i, $allowedentitynames, true ) ) {
Note: See TracChangeset for help on using the changeset viewer.