Make WordPress Core

Opened 6 weeks ago

Closed 6 weeks ago

#64383 closed defect (bug) (reported-upstream)

wp-includes/js/dist/i18n.js sprintf function breaks on empty string

Reported by: joepenzo's profile joepenzo Owned by:
Milestone: Priority: normal
Severity: normal Version: 6.9
Component: I18N Keywords: needs-patch
Focuses: Cc:

Description

Older WooCommerce admin analytics pages generat empty strings, which breaks in the i18n sprintf() method.

This happens on the analytics overview page in React components (/wp-admin/admin.php?page=wc-admin&path=analytics-overview)

Is there a reason that the string variable isn't checked before the replace?
https://github.com/WordPress/WordPress/blob/master/wp-includes/js/dist/i18n.js#L172

Happens and tested on WooCommerce versions:

  • 9.6.1
  • 9.6.2
  • 9.8.4
  • 9.9.4
  • 9.9.5

Change History (3)

#1 @joepenzo
6 weeks ago

  • Summary changed from wp-includes/js/dist/i18n.js sprintf function break on empty string to wp-includes/js/dist/i18n.js sprintf function breaks on empty string

#2 @joepenzo
6 weeks ago

Also happens and tested on WooCommerce versions:

  • 10.0.0/10.0.3

WooCommerce fixed this in version 10.0.4

#3 @swissspidy
6 weeks ago

  • Milestone Awaiting Review deleted
  • Resolution set to reported-upstream
  • Status changed from new to closed

Hi there and welcome to WordPress Trac

I think we're discussing this already in https://github.com/WordPress/gutenberg/issues/70824

While the code had a more defensive approach before, it's really the plugin doing something wrong by passing undefined. Since WooCommerce fixed this a long time ago, we suggest updating the plugin.

There were no other plugins doing it wrong, so there was no need for a revert on the WordPress side.

Note: See TracTickets for help on using tickets.