Skip to content

Remove misapplied wp_kses_post from inline-save success paths#948

Merged
GaryJones merged 1 commit intodevelopfrom
GaryJones/fix-inline-save-single-row-deprecations
Apr 24, 2026
Merged

Remove misapplied wp_kses_post from inline-save success paths#948
GaryJones merged 1 commit intodevelopfrom
GaryJones/fix-inline-save-single-row-deprecations

Conversation

@GaryJones
Copy link
Copy Markdown
Contributor

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:

  • `modules/custom-status/custom-status.php:1341`
  • `modules/editorial-metadata/editorial-metadata.php:1459`
  • `modules/user-groups/user-groups.php:556`

Test plan

  • With `WP_DEBUG` and `WP_DEBUG_LOG` on, inline-edit a Custom
    Status (Quick Edit → Update Status). No new `Deprecated`
    entries in `debug.log`, and the row refreshes in place.
  • Same for an Editorial Metadata term.
  • Same for a User Group.

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.
@GaryJones GaryJones requested a review from a team as a code owner April 24, 2026 00:37
@GaryJones GaryJones self-assigned this Apr 24, 2026
@GaryJones GaryJones added this to the Next milestone Apr 24, 2026
@GaryJones GaryJones merged commit 72341dc into develop Apr 24, 2026
10 checks passed
@GaryJones GaryJones deleted the GaryJones/fix-inline-save-single-row-deprecations branch April 24, 2026 00:40
@GaryJones GaryJones mentioned this pull request Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant