Opened 6 weeks ago
Closed 5 weeks ago
#63108 closed defect (bug) (duplicate)
deprecated warning in /wp-includes/kses.php
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Formatting | Keywords: | has-patch |
Focuses: | Cc: |
Description
one deprecated warning in /wp-includes/kses.php:
Backtrace from warning 'preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated' at /wp-includes/kses.php 1805:
This is the line of code causing the error: $content = preg_replace( '/[\x00-\x08\x0B\x0C\x0E-\x1F]/', '', $content );
This is the adjusted code to fix the issue: $content = preg_replace('/[\x00-\x08\x0B\x0C\x0E-\x1F]/', '', $content ?? '');
Change History (2)
This ticket was mentioned in PR #8512 on WordPress/wordpress-develop by @rpayne7264.
6 weeks ago
#1
- Keywords has-patch added
Note: See
TracTickets for help on using
tickets.
Update /wp-includes/kses.php to fix deprecated warnings:
-- Backtrace from warning 'preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated' at /wp-includes/kses.php 1805:
This was the line of code causing the error:
$content = preg_replace( '/[\x00-\x08\x0B\x0C\x0E-\x1F]/', , $content );
around line 1805, updated code to:
$content = preg_replace('/[\x00-\x08\x0B\x0C\x0E-\x1F]/', '', $content ?? '');
The ?? operator ensures that if $content is null, it is replaced with an empty string () before being processed by preg_replace().
Trac ticket: https://core.trac.wordpress.org/ticket/63108