[PHP-DEV] [RFC] [DISCUSSION] Locale-independent float to string cast

2020-03-24 Thread Máté Kocsis
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. Plea

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

2020-03-24 Thread Lynn
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 wh

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

2020-03-24 Thread Nikita Popov
On Tue, Mar 24, 2020 at 10:40 AM 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 prob

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

2020-03-24 Thread Christoph M. Becker
On 24.03.2020 at 11:03, Lynn wrote: >> 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 wher

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

2020-03-24 Thread G. P. B.
On Tue, 24 Mar 2020 at 11:03, Lynn wrote: > 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

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

2020-03-24 Thread Lynn
On Tue, Mar 24, 2020 at 7:41 PM G. P. B. wrote: > On Tue, 24 Mar 2020 at 11:03, Lynn wrote: > >> 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 >> > > We are not saying that this won't be preva

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

2020-03-24 Thread Máté Kocsis
Hi Lynn, > There are automated data exports with prices, that will be automatically consumed on the other side. I agree that these cases can go horribly wrong. However, my reasoning is the following: - if a piece of code currently relies on locale-independence (e.g. automated data exports) then t

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

2020-03-25 Thread Lynn
I'm very sorry, I pressed the reply instead of reply all button, I hope this fixes it! I agree that these cases can go horribly wrong. However, my reasoning is > the following: > - if a piece of code currently relies on locale-independence (e.g. > automated data exports) then this > change wouldn'

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

2020-03-26 Thread Máté Kocsis
Hi Lynn, Thank you very much for the input! Then we could add a secondary vote to the RFC where an upgrade path was decided upon. The first such path is the one proposed by Christoph: Introduce a temporary ini setting with which a "debug" mode of float to string casting could be enabled. That is,

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

2020-04-15 Thread G. P. B.
Hello all, We've updated the implementation [1] and RFC [2] to provide a temporary INI setting which will emit a warning every time a locale-aware float to string conversation would have been done in PHP 7. It's current name debug_local_sensitive_float_casts is also up to debate and will be voted