Skip to content

Conversation

@Sukhendu2002
Copy link

Trac ticket: https://core.trac.wordpress.org/ticket/60495
Patch refresh for: #6637


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@github-actions
Copy link

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@Sukhendu2002 Sukhendu2002 marked this pull request as ready for review February 11, 2025 07:04
@github-actions
Copy link

github-actions bot commented Feb 11, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props sukhendu2002, mindctrl, westonruter, shailu25.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@swissspidy swissspidy requested a review from audrasjb February 11, 2025 11:50
@mindctrl
Copy link

@Sukhendu2002 could you merge the latest trunk changes into this to see if that fixes the test issues?

@mindctrl
Copy link

Test Report added to the Trac ticket: https://core.trac.wordpress.org/ticket/60495#comment:26

* @param string $type The status slug being filtered.
*/
$text = apply_filters( 'plugins_list_status_text', '', $count, $type );
if ( empty( $text ) ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ( empty( $text ) ) {
if ( empty( $text ) || ! is_string( $text ) ) {

if ( empty( $text ) ) {
$text = $type;
}
$text .= ' ' . sprintf(
Copy link
Member

@westonruter westonruter Sep 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe not strictly necessary but for sanity's sake:

Suggested change
$text .= ' ' . sprintf(
$text = esc_html( $text ) . ' ' . sprintf(

break;
default:
/**
* Filter the status text of default switch case in the Plugins list table.
Copy link
Member

@westonruter westonruter Sep 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be capitalized?

Suggested change
* Filter the status text of default switch case in the Plugins list table.
* Filters the status text of default switch case in the plugins list table.

Comment on lines +591 to +593
* @param string $text Plugins list status text. Default empty string.
* @param int $count Count the Number of plugins.
* @param string $type The status slug being filtered.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param string $text Plugins list status text. Default empty string.
* @param int $count Count the Number of plugins.
* @param string $type The status slug being filtered.
* @param string $text Plugins list status text. Default empty string.
* @param int $count Count of the number of plugins.
* @param string $type The status slug being filtered.

* @param int $count Count the Number of plugins.
* @param string $type The status slug being filtered.
*/
$text = apply_filters( 'plugins_list_status_text', '', $count, $type );
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of checking for a string as suggested below, should we force a string value from the filter?

Suggested change
$text = apply_filters( 'plugins_list_status_text', '', $count, $type );
$text = (string) apply_filters( 'plugins_list_status_text', '', $count, $type );

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That could result in a PHP warning if the filter returns an array: https://3v4l.org/XAR5P

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. My thought was that, since WP core does this kind of casting already in numerous places, it would be safe to do since a warning doesn't stop execution, and it provides clues about incorrect code that doesn't provide expected results, whereas without it we kinda hide the problem. But as your example shows, having a string that says "Array" isn't very helpful either. Happy to withdraw my suggestion.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't feel strongly about it. If someone uses this filter to return anything other than a string then they are doing it wrong anyway. There's probably a literal billion other places on WP where this kind of thing would also happen currently.

@mindctrl
Copy link

@Sukhendu2002 are you available to update your PR to address the review from Weston?

@shail-mehta
Copy link
Member

Patch Refreshed in this PR #10133

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants