Formatting: Avoid escaping valid XML values in `esc_xml()`.
This change improves the `esc_xml()` function by replacing two `empty()` checks with `isset()` to cover values that are not equal to `''` but still returning `true` when checked with `empty()`, like `'0'`, `0` or `false`. It also updates the related unit tests accordingly. Props rumpel2116, pbiron. Fixes #55399. Built from https://develop.svn.wordpress.org/trunk@53144 git-svn-id: http://core.svn.wordpress.org/trunk@52733 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
523c679e76
commit
70dea8e3c2
|
@ -4639,11 +4639,11 @@ EOF;
|
||||||
$safe_text = (string) preg_replace_callback(
|
$safe_text = (string) preg_replace_callback(
|
||||||
$regex,
|
$regex,
|
||||||
static function( $matches ) {
|
static function( $matches ) {
|
||||||
if ( ! $matches[0] ) {
|
if ( ! isset( $matches[0] ) ) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! empty( $matches['non_cdata'] ) ) {
|
if ( isset( $matches['non_cdata'] ) ) {
|
||||||
// escape HTML entities in the non-CDATA Section.
|
// escape HTML entities in the non-CDATA Section.
|
||||||
return _wp_specialchars( $matches['non_cdata'], ENT_XML1 );
|
return _wp_specialchars( $matches['non_cdata'], ENT_XML1 );
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.0-alpha-53143';
|
$wp_version = '6.0-alpha-53144';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue