Opened 6 years ago
Last modified 6 years ago
#44531 new defect (bug)
Multiple bytes decimal point and thousands separator in number_format_i18n PHP < 5.4
Reported by: | remcotolsma | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | I18N | Keywords: | has-patch has-unit-tests dev-feedback 2nd-opinion |
Focuses: | Cc: |
Description
PHP number_format
has only multiple bytes support in the decimal point and thousands separator parameters since PHP 5.4.0. There is some code in place in wp-includes/class-wp-locale.php
to work around this:
<?php if ( version_compare( PHP_VERSION, '5.4', '>=' ) ) { // Replace space with a non-breaking space to avoid wrapping. $thousands_sep = str_replace( ' ', ' ', $thousands_sep ); } else { // PHP < 5.4.0 does not support multiple bytes in thousands separator. $thousands_sep = str_replace( array( ' ', ' ' ), ' ', $thousands_sep ); }
Since we don't know how translators translate number_format_thousands_sep
and number_format_decimal_point
i don't think this is working in all cases. In the French translation files there is currently a multibyte non-breaking space char. Above code will not replace the multibyte non-breaking space char to a regular space.
Also see: https://make.wordpress.org/polyglots/2013/06/24/number_format-bug/.
Attachments (1)
Note: See
TracTickets for help on using
tickets.
Related: #10373