[wp-trac] [WordPress Trac] #62785: wp_kses_no_null() should be modified to handle $content having a null value
WordPress Trac
noreply at wordpress.org
Wed Jan 14 10:00:25 UTC 2026
#62785: wp_kses_no_null() should be modified to handle $content having a null value
-------------------------------------------------+-------------------------
Reporter: room34 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting
| Review
Component: Formatting | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests php81 | Focuses: php-
needs-testing | compatibility
-------------------------------------------------+-------------------------
Comment (by huzaifaalmesbah):
== Test Report
Patch tested: https://github.com/WordPress/wordpress-develop/pull/8096
=== Steps to Reproduce or Test
1. Create a plugin file any named (e.g: reproduce-kses-null.php) with the
Helper Plugin Code provided below.
2. Navigate to the WordPress admin dashboard and activate the plugin.
3. Observe the admin notice displayed at the top of the screen.
=== Helper Plugin Code
{{{
<?php
/**
* Plugin Name: Reproduce KSES Null Issue
*/
add_action( 'admin_notices', function() {
$err = null;
$old = error_reporting( E_ALL );
set_error_handler( function( $no, $str ) use ( &$err ) {
if ( strpos( $str, 'Passing null' ) !== false ) $err =
$str;
} );
wp_kses_no_null( null );
restore_error_handler();
error_reporting( $old );
$class = $err ? 'error' : 'success';
$msg = $err ? "FAIL: $err" : 'PASS: No deprecation warning.';
echo "<div class='notice notice-$class'><p>$msg of
wp_kses_no_null</p></div>";
} );
}}}
=== Expected Results
- ✅ The function `wp_kses_no_null( null )` should return an empty string.
- ✅ No deprecation warnings (e.g., preg_replace(): Passing null...)
should be triggered.
=== Environment
- WordPress: 7.0-alpha-61215-src
- PHP: 8.2.29
- Server: nginx/1.29.4
- Database: mysqli (Server: 8.4.7 / Client: mysqlnd 8.2.29)
- Browser: Chrome 143.0.0.0
- OS: macOS
- Theme: Twenty Twenty-Five 1.4
- MU Plugins: None activated
- Plugins:
* Reproduce KSES Null Issue
* Test Reports 1.2.1
==== Actual Results
Before applying the patch
- ❌ A deprecation warning notice was displayed: FAIL: Deprecation warning
detected...
After applying the bugfix patch
- ✅ Issue resolved. The success notice PASS: No deprecation warning. is
displayed.
=== Screenshots
|| Before Apply Patch || After Apply Patch ✅ ||
|| [[Image(https://i.ibb.co/qSmD9NK/Huzaifa-20260114155814.png)]] ||
[[Image(https://i.ibb.co/27ghYqv7/Huzaifa-20260114155745.png)]] ||
--
Ticket URL: <https://core.trac.wordpress.org/ticket/62785#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list