Conversation
The inline-save AJAX handlers in Custom Statuses, Editorial Metadata
and User Groups all echo a refreshed table row after a successful
update by way of:
echo wp_kses_post( $wp_list_table->single_row( $return ) );
Because WP_List_Table::single_row() echoes internally and returns
void, the row HTML is already out the door before wp_kses_post
receives null. On PHP 8.1+ that null propagates through the kses
chain (wp_kses_post → wp_kses → wp_kses_no_null → preg_replace x 2)
and emits five "passing null to non-nullable parameter" deprecations
on every successful inline save.
This is the same bug PR 947 fixed on the list-rendering path; three
further call sites were missed because they referenced single_row
via a $wp_list_table variable rather than $this. Remove the
wrappers and let single_row() do its own output. The column_*
callbacks in each list table already return pre-escaped strings,
which is the documented contract.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PR 947 fixed five PHP 8.1+ deprecations per row on the Custom
Statuses, Editorial Metadata and User Groups list screens. Three
further call sites with the same bug were missed because they
reference `single_row()` via a `$wp_list_table` local variable
rather than `$this` — my grep only caught the latter.
Each of these handlers runs on a successful inline save and echoes
the refreshed row back to the browser via:
```php
echo wp_kses_post( $wp_list_table->single_row( $return ) );
```
Because `WP_List_Table::single_row()` echoes internally and returns
void, the row HTML is already in the response before `wp_kses_post()`
receives `null`. On PHP 8.1+ that null propagates through the kses
chain (`wp_kses_post` → `wp_kses` → `wp_kses_no_null` → two
`preg_replace` calls) and emits five "passing null to non-nullable
parameter" deprecations every time an admin inline-saves a status,
editorial metadata term or user group.
Drop the wrappers and let `single_row()` do its own output. The
`column_*` callbacks in each list table already return pre-escaped
strings, which is the documented `WP_List_Table` contract.
Locations:
Test plan
Status (Quick Edit → Update Status). No new `Deprecated`
entries in `debug.log`, and the row refreshes in place.