#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 has-unit-tests |
| 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 (3)
This ticket was mentioned in PR #8512 on WordPress/wordpress-develop by @rpayne7264.
11 months ago
#1
- Keywords has-patch added
#2
@
11 months ago
- Component changed from Security to Formatting
- Keywords changes-requested removed
- Milestone Awaiting Review deleted
- Resolution set to duplicate
- Status changed from new to closed
- Version 6.7.2 deleted
#62785 already proposed silencing the deprecation notice in wp_kses_no_null().
This ticket was mentioned in PR #10712 on WordPress/wordpress-develop by @mohammadzaid.
6 weeks ago
#3
- Keywords has-unit-tests added
Trac: #63108 (Good First Bug)
Scoped ARIA labels in LinkControlSearchInput to improve accessibility.
Changes:
tests/phpunit/includes/bootstrap.php: Added test isolationgutenberg/packages/block-editor/src/components/link-control/search-input.js: Scoped ARIA labelspackages/components/src/modal/index.tsx: Modal improvements
Fixes:
- Test_WP_Customize_Custom_CSS_Setting::test_update_custom_css_updates_theme_mod
Why:
Accessibility enhancement for LinkControl dialog. Good-first-bug contribution.
Props: @Zaidfarooqui01
See: https://core.trac.wordpress.org/ticket/63108
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