Re: [RFC] [DISCUSSION] Locale-independent float to string cast
| From: | Andrea Faulds | Date: | Wed, 15 Apr 2020 20:54:21 +0000 |
| Subject: | Re: [RFC] [DISCUSSION] Locale-independent float to string cast | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-109671@lists.php.net to get a copy of this message | ||
Hi,
Máté Kocsis wrote:
Hi Internals, Together with George, I'd like to propose an RFC for a long-standing problem PHP has: casting floats to string depends on the locale settings. As this behaviour is nonsense, and because it can cause quite serious problems, we would like to get rid of locale-dependence in PHP 8. Please find our RFC at https://wiki.php.net/rfc/locale_independent_float_to_string. Regards, George and MátéJust a little thing, saying “certain locales (notably the German, French, and Spanish ones)” perhaps understates the issue. Most non-English-speaking countries do not use . as the decimal separator! https://en.wikipedia.org/wiki/Decimal_separator#Arabic_numerals Anyway, thank you for this RFC, I think fixing this is long, long overdue. I expect there could be a serious BC impact for certain PHP users, but I don't think there is a good long-term solution for this short of forcing such code to be updated. As a potential improvement, I would suggest to try to be closer to comprehensive in documenting which functions' behaviour changes or does not. For example, this RFC doesn't currently say what happens to settype() and print_r(). Thanks, Andrea