Re: [RFC] [DISCUSSION] Locale-independent float to string cast

From: Date: Tue, 24 Mar 2020 10:03:17 +0000
Subject: Re: [RFC] [DISCUSSION] Locale-independent float to string cast
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-109262@lists.php.net to get a copy of this message
Hi, This is a great RFC! Just one minor thing. > Outputting floats as strings in locales which change the decimal separator will have a slightly different output. In our opinion, the backward compatibility break won't be serious in practice In my opinion, this will be huge. I can't trace back where the thousands of possible conversions are used in legacy software. There's a variety of custom format functions, sprintf implementations, string casts, and number_format usages. Would it be possible to trigger a warning or deprecation when using a locale that would have a different result from what the new result will be? If I'd use a locale that results in 3.5, I don't need a warning. If I use a locale that results in 3,5, I would like to see a warning of sorts so I can fix this before untested legacy code will seriously break data exports. Regards, Lynn On Tue, Mar 24, 2020 at 10:40 AM Máté Kocsis <kocsismate90@gmail.com> 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é >

« previous php.internals (#109262) next »