TGMPA/TGM-Plugin-Activation

sprint

simongcc opened this issue · 1 comments

The following error then occur during installation of some plugins in a theme:

Warning: sprintf(): Too few arguments in ......../wp-admin/includes/class-bulk-upgrader-ski

The plugin is then installed but not sure if anything is being interrupted due to the warning.
I found that the warning appear due to the following suspected bug found:

$this->upgrader->strings['skin_update_successful'] = esc_html__( '%1$s installed successfully.', 'theme-name' ) . ' <a href="#" class="hide-if-no-js" onclick="%2$s"><span>' . esc_html__( 'Show Details', 'theme-name' ) . '</span><span class="hidden">' . esc_html__( 'Hide Details', 'theme-name' ) . '</span>.</a>';

In the original code of TGM-Plugin-Activation class-tgm-plugin-activation.php on line 3674

$this->upgrader->strings['skin_update_successful'] .= ' <a href="#" class="hide-if-no-js" onclick="%2$s"><span>' . esc_html__( 'Show Details', 'tgmpa' ) . '</span><span class="hidden">' . esc_html__( 'Hide Details', 'tgmpa' ) . '</span>.</a>';

There are 2 defined variable placeholder for being substituted and expected 2 arguments from them
%1$s
%2$s

However,

// in WP 4.9.8 class-bulk-upgrader-skin.php on line 150
... sprintf( $this->upgrader->strings['skin_update_successful'], $title ) ...
// Only $title is being put into it

In PHP 5.6.3 tested, this error does not appear, maybe surpassed or ignored.
In PHP 7.19 tested, the error come out, maybe it test strictly.

Because I found in the theme, I have also reported to the theme author.
The above findings is for your reference.

Thanks a lot for providing such a convenient tools.

jrfnl commented

Closing as duplicate of #669 which was fixed by PR #670. The fix will be in the next release of TGMPA.