Re: Inconsistent float to string vs. string to floatcasting
| From: | Nikita Popov | Date: | Wed, 02 Jan 2019 09:26:30 +0000 |
| Subject: | Re: Inconsistent float to string vs. string to floatcasting | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-103660@lists.php.net to get a copy of this message | ||
On Wed, Jan 2, 2019 at 12:30 AM Stanislav Malyshev <smalyshev@gmail.com>
wrote:
> Hi!
>
> > So yes, (string)0.3 should return 0.3 in any locale.
>
> If we designed it now, without any doubt. But since we have 20 years of
> history behind... I'm not so sure.
>
> > Finally, I don't think that the global locale is the real problem for
> > PHP. Rather it's PHP locale handling and the fact that setlocale()
> > works per process (and not per thread). When PHP starts up, no locale
>
> That's part of locale being global. Though even in environment where
> threads are not involved, many apps do not account for locale quirks.
>
We have a rather hard policy against ini options that influence language
behavior. Locale-dependent language behavior is essentially the same issue,
just worse due to the mentioned issues, in particularly lack of
thread-safety and the possibility that the locale is changed by third-party
libraries at runtime.
We have removed existing ini flags controlling language behavior in the
past. I would say these removals were much more significant than what is
proposed here, but we did them anyway, and I think we are now in a better
place for it.
Regards,
Nikita