Make WordPress Core

Changeset 54672

Timestamp:
10/24/2022 02:47:10 PM (22 months ago)
Author:
SergeyBiryukov
Message:

KSES: Display a notice if any of the required globals are not set.

When using the CUSTOM_TAGS constant, these global variables should be set to arrays:

  • $allowedposttags
  • $allowedtags
  • $allowedentitynames
  • $allowedxmlentitynames

This commit aims to improve developer experience by displaying a more helpful message to explain a PHP fatal error further in the code if any of these globals are either not set or not an array.

Note Using CUSTOM_TAGS is not recommended and should be considered deprecated. The wp_kses_allowed_html filter is more powerful and supplies context.

Follow-up to [832], [834], [2896], [13358], [21796], [28845], [43016], [48072].

Props doctorlai, pento, KnowingArt_com, bosconiandynamics, TJNowell, ironprogrammer, audrasjb, mukesh27, SergeyBiryukov.
Fixes #47357.

File:
1 edited

Legend:

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

    r54181 r54672  
    3636 * Using `CUSTOM_TAGS` is not recommended and should be considered deprecated. The
    3737 * {@see 'wp_kses_allowed_html'} filter is more powerful and supplies context.
     38
     39
     40
     41
     42
     43
     44
    3845 *
    3946 * @see wp_kses_allowed_html()
     
    686693    $allowedposttags = array_map( '_wp_add_global_attributes', $allowedposttags );
    687694} else {
     695
     696
     697
     698
     699
     700
     701
     702
     703
     704
     705
     706
     707
     708
     709
     710
     711
     712
     713
     714
     715
     716
     717
     718
     719
     720
     721
    688722    $allowedtags     = wp_kses_array_lc( $allowedtags );
    689723    $allowedposttags = wp_kses_array_lc( $allowedposttags );
Note: See TracChangeset for help on using the changeset viewer.