Skip to content

Commit

Permalink
Script Loader: Add missing escaping function to Moment.js string lo…
Browse files Browse the repository at this point in the history
…calization.

This changeset avoids breaking the inline script added for `Moment.js` localization if for some reason `get_user_locale()` doesn't return a simply string.

Props swissspidy.
Fixes #61341.




git-svn-id: https://develop.svn.wordpress.org/trunk@58288 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
audrasjb committed Jun 2, 2024
1 parent 0085fcb commit 8a8499d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/wp-includes/script-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ function wp_default_packages_vendor( $scripts ) {
'moment',
sprintf(
"moment.updateLocale( '%s', %s );",
get_user_locale(),
esc_js( get_user_locale() ),
wp_json_encode(
array(
'months' => array_values( $wp_locale->month ),
Expand Down

0 comments on commit 8a8499d

Please sign in to comment.