From 91e7a067a899aec21db75e6a6641d41cd678c9b9 Mon Sep 17 00:00:00 2001 From: dmsnell Date: Wed, 28 Feb 2024 21:15:12 +0000 Subject: [PATCH] HTML API: Remove superfluous type-coercing empty() check. When returning modifiable text in the HTML API, if the text segment coerces to `false` inside `empty()`, then an empty string has been returned instead of the string itself. For example, the text node in the following HTML snippet: {{{
0
}}} In this patch the `empty()` check is removed. The purpose of the original check was to skip further processing if the text content is empty, but the check is not needed and the additioanl processing is minimal. Removing the code removes the defect and leaves a cleaner method in its absence. Developed in https://github.com/WordPress/wordpress-develop/pull/6199 Follow-up to [57348] Follow-up to #60170 Built from https://develop.svn.wordpress.org/trunk@57738 git-svn-id: http://core.svn.wordpress.org/trunk@57239 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/html-api/class-wp-html-tag-processor.php | 4 ---- wp-includes/version.php | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/wp-includes/html-api/class-wp-html-tag-processor.php b/wp-includes/html-api/class-wp-html-tag-processor.php index 447f4dac1b..d5e43251af 100644 --- a/wp-includes/html-api/class-wp-html-tag-processor.php +++ b/wp-includes/html-api/class-wp-html-tag-processor.php @@ -2810,10 +2810,6 @@ class WP_HTML_Tag_Processor { $decoded = html_entity_decode( $text, ENT_QUOTES | ENT_HTML5 | ENT_SUBSTITUTE ); - if ( empty( $decoded ) ) { - return ''; - } - /* * TEXTAREA skips a leading newline, but this newline may appear not only as the * literal character `\n`, but also as a character reference, such as in the diff --git a/wp-includes/version.php b/wp-includes/version.php index 5ee588f9ae..5ccfc60d90 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.5-beta3-57737'; +$wp_version = '6.5-beta3-57738'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.