Make WordPress Core

Opened 6 weeks ago

Closed 6 weeks ago

#61420 closed defect (bug) (fixed)

Plugins: Remove unassigned sprintf from wp_get_plugin_action_button()

Reported by: hellofromtonya's profile hellofromTonya Owned by: hellofromtonya's profile hellofromTonya
Milestone: 6.5.5 Priority: normal
Severity: minor Version: 6.5
Component: Plugins Keywords: has-patch commit dev-reviewed
Focuses: Cc:

Description

[57545] introduced wp_get_plugin_action_button(). After speaking with @costdev, it appears an unassigned sprintf was accidentally included (the code line starts here). A copy/paste whoopsie.

        sprintf(
                '<a class="install-now button" data-slug="%s" href="%s" aria-label="%s" data-name="%s" role="button">%s</a>',
                esc_attr( $data->slug ),
                esc_url( $status['url'] ),
                /* translators: %s: Plugin name and version. */
                esc_attr( sprintf( _x( 'Install %s now', 'plugin' ), $name ) ),
                esc_attr( $name ),
                _x( 'Install Now', 'plugin' )
        );

As this code does not assign to a variable, it is not used and thus dead code. This ticket will remove it.

Change History (10)

This ticket was mentioned in PR #6792 on WordPress/wordpress-develop by @hellofromTonya.


6 weeks ago
#1

  • Keywords has-patch added

Removes the unused / unassigned sprintf code from wp_get_plugin_action_button().

Trac ticket: https://core.trac.wordpress.org/ticket/61420

@rajinsharwar commented on PR #6792:


6 weeks ago
#2

Wondering how this was here, unnoticed...

#3 @hellofromTonya
6 weeks ago

  • Keywords commit added

Patch: https://github.com/WordPress/wordpress-develop/pull/6792

2 approvals. CI all green. Committing.

#4 @hellofromTonya
6 weeks ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 58402:

Plugins: Remove unassigned sprintf in wp_get_plugin_action_button().

Removes an unassigned sprintf that was accidentally included as part of [57545] in the wp_get_plugin_action_button(). A copy/paste whoopsie.

The actual used code is assigned a wee bit lower in the function within the install case.

Follow-up to [57545].

Props hellofromTonya, costdev, rajinsharwar.
Fixes #61420.

#6 @hellofromTonya
6 weeks ago

@jorbin @costdev this is another good candidate to backport to 6.5 branch if a 6.5.5 is planned. Also noting, it might be a good one to backport anyway as it doesn't affect production code, but rather removes dead code to avoid confusion.

#7 @jorbin
6 weeks ago

  • Keywords dev-reviewed added
  • Milestone changed from 6.6 to 6.5.5

@hellofromTonya I agree. I think we should backport it so that it goes out if a 6.5.5 happens even if it's not a driving force for a 6.5.5

I've also reviewed [58402] and am approving it for backport.

#8 @jorbin
6 weeks ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

#9 @hellofromTonya
6 weeks ago

Awesome. I'll backport it now. Thanks @jorbin.

#10 @hellofromTonya
6 weeks ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 58404:

Plugins: Remove unassigned sprintf in wp_get_plugin_action_button().

Removes an unassigned sprintf that was accidentally included as part of [57545] in the wp_get_plugin_action_button(). A copy/paste whoopsie.

The actual used code is assigned a wee bit lower in the function within the install case.

Follow-up to [57545].

Reviewed by jorbin.
Merges [58402] to the 6.5 branch.

Props hellofromTonya, costdev, rajinsharwar.
Fixes #61420.

Note: See TracTickets for help on using tickets.