Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109278 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 36815 invoked from network); 24 Mar 2020 20:17:15 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 24 Mar 2020 20:17:15 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 698A6180546 for ; Tue, 24 Mar 2020 11:41:42 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 24 Mar 2020 11:41:41 -0700 (PDT) Received: by mail-ed1-f44.google.com with SMTP id de14so3618823edb.4 for ; Tue, 24 Mar 2020 11:41:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=SeLocLbH0OspzEDRZqM6bdMPFm5zUH0gANuRmgkTnOA=; b=GWdVeuH5Lnt/d6/Rl3dHKWQQmTv9FK8XVfdmbSfq0jZi8CNUDW+MXwemtnnwi/nRl+ xrCpWRwlLKbzCKKtp6cxkNNx+txI5+GVWYpXx1XAxjrG8TTvWsVsnxhnJcJP3CbTXTk9 XHsjlZC/MtN+oYYnzMWPgrrQcW7saaWvCy8SlD2Q9IkkpihYMh6HqHaMSBtA6cxzf4Vw +Gm0JaNOQKicujbGxdZFxPpzIdzvzNSAjrCxWhUV8kqJcG/NPP71Z8blsmRaUJFeKRRV hy9jATqfqzs0ZsCPiv4udjOVHCwCvaHL4A0SK0LQSQRFZQQYwzmK3JUKu/A5xhi3Iaf5 5QiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=SeLocLbH0OspzEDRZqM6bdMPFm5zUH0gANuRmgkTnOA=; b=KRkj10wgXsuN+wIH9xPo4XERgvpz8IZ42H8WZznlhlbs/Kyi2qccE4WbK1sprFRqi+ XZP1lzDfiZAWPP+fidPS2HoXqOolHNot5ftCmei58qZ3kX3+FXJ57CLVgzQL26qmRPd7 DilH3u5FSEP4YZDjse3AB4l9EMD85fj5cyEJSFusM2wfKkPeBloY3J9R/UB72M+tWC7M gHb7QvLWmLMAdUF+LM9g78U8r/R7Ey0rWAldEFMYC+ZtjK57NIFqAzu51r8wtmzXi1t7 SONLK/lQVih9k8vRZ/vw7V7NWhNfyjOXWYahyj4KYTD+gX4OT2wuS9VuSbsgOiarENbP Qofg== X-Gm-Message-State: ANhLgQ0jHL7lPL7xAkPaDOfXnzSoImu+RFLTNO6OdxDWrs5ZAPpblN+O lxKjg52XM2uVsLDlEhiQzDGyeWWszGY4QWI2pUg= X-Google-Smtp-Source: ADFU+vsUyDDeENlVJuh0ZgDNlucrUAwktj491ISZOHnBBZkmp4ILDQL/PBsdjL/8l9ShWsolf4Tf/KCcgDIP0OE91yI= X-Received: by 2002:a17:906:848d:: with SMTP id m13mr8241579ejx.348.1585075297519; Tue, 24 Mar 2020 11:41:37 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 24 Mar 2020 19:41:28 +0100 Message-ID: To: Lynn , Nikita Popov Cc: =?UTF-8?B?TcOhdMOpIEtvY3Npcw==?= , PHP Internals List Content-Type: multipart/alternative; boundary="0000000000000d162f05a19e1ae0" Subject: Re: [PHP-DEV] [RFC] [DISCUSSION] Locale-independent float to string cast From: george.banyard@gmail.com ("G. P. B.") --0000000000000d162f05a19e1ae0 Content-Type: text/plain; charset="UTF-8" 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 > > 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 > We are not saying that this won't be prevalent,especially in legacy code, however, IMHO, this is not a serious issue as it is only a matter how one character is displayed to end users. As said by Christoph we did not consider a deprecation warning due to the performance impact this would lead to as float to string conversions are a common operation. The idea of a temporary INI setting which warn about these conversions is an interesting idea, but I personally would rather not introduce one. Moreover, with a temporary INI setting how long would it last, one minor version, one major version? Something in between the two? On Tue, 24 Mar 2020 at 11:15, Nikita Popov wrote: > I'm obviously in favor of this proposal. > > Only really comment I have is on printf(): You're right that we have %f and > %F to toggle locale-sensitivity, but the %e, %E, %g, %G formats are always > locale-sensitive. It might make sense to introduce locale-insensitive > variants of those, especially considering that %G is considered the > "standard" floating point format. Internally we support %H for that, so we > could expose that... (Alternatively, locale-sensitivity might be removed > for e/E/g/G.) > > Regards, > Nikita *sight* I was not aware of this issue ... Personally, I would prefer that %e and %E are not locale aware as they are meant to represent a standard notation. This would then mean that %g is locale aware as %f is and %G is not because %E and %F are not locale aware. But I'm open to suggestion considering this edge case. Best regards George P. Banyard --0000000000000d162f05a19e1ae0--