Opened 8 years ago
Closed 4 months ago
#44531 closed defect (bug) (duplicate)
Multiple bytes decimal point and thousands separator in number_format_i18n PHP < 5.4
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | |
| Component: | I18N | Keywords: | has-patch has-unit-tests dev-feedback |
| 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)
Change History (5)
#3
@
4 months ago
- Keywords close added
Hi @remcotolsma,
I have just come across this ticket now, and as WordPress no longer supports PHP below 7.2 in the latest release. WordPress actually dropped support for PHP 5.4 back in version 5.6 of WordPress.
As we are a good couple of major releases ahead of that version I am going to mark this ticket with the close tag.
Related: #10373