Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109282 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 74843 invoked from network); 25 Mar 2020 10:01:42 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 25 Mar 2020 10:01:42 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6B7461804C3 for ; Wed, 25 Mar 2020 01:26:17 -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=-0.2 required=5.0 tests=BAYES_20,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-il1-f181.google.com (mail-il1-f181.google.com [209.85.166.181]) (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 ; Wed, 25 Mar 2020 01:26:16 -0700 (PDT) Received: by mail-il1-f181.google.com with SMTP id p13so1064106ilp.3 for ; Wed, 25 Mar 2020 01:26:16 -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=uHiSt+5p1h9scvO1LRpwDO6NHryJZJsgrg9rRRWf974=; b=tQWscHWrG3RhgYEttgayGWsFJz9CJJJM8iCJswgaBbenULY4vllTLa7JBlsk8nIHgJ hU3obD+Q6vxff5Swy1mS6xSSOBS22RToZpnNz4k5mulbdf4doAY3dYfG2uiSvw1qlKfV 46216iMMk6jrlivOMM0olzr9NnHm9aYP2YHVHhuV39AKX12V0Ehcwa4s0QypKTPQzmKo zz0HW0/SNsdwhOnsg5DVFJn5AR+5LUm7D6WSG1I3lWWd7Dl5fuHH2UB92ng8hxaWIbGr 9Ph5/xaGT1DK5sxJIZajg9QPEFLCSfOR9pT4tNqE+bZEeSIPZsasint/pphtEaR6l2r7 9MmA== 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=uHiSt+5p1h9scvO1LRpwDO6NHryJZJsgrg9rRRWf974=; b=ApJ01pmNAJAbEatNu5IrDHKxLRb/3E6rsbYru8tOZ4b8tLuTG39t176x02l/TFvZyW goUvfmGPOi37cMVe+/SUISad9sWN2osdMQaDB3q7lZ+RrdmBDiu/ynMzMa+kBH8j32Eo oW7S9ELe/vbtLbDKo37nPBEcfNCX7x+TcRW1wcbIhSO4ciyGnx/pB5jb4/j7h0KYhbOc jMG5jCGz0p6m45vNRhurUsG5LO5OTcxZL7RwhqJBJzJBCp7jOAEGYuLqX7RpqJ6UmxpO v0aiFSXS1h3i//bQF7gbW1Gn+d3s16r2eXO9YGDHEts1FZvKbwugwMuiyG6198pkU5w5 xiAA== X-Gm-Message-State: ANhLgQ2Bld1UdKP+tdlA06chkcoG585hZpkJnbx6DOcmtpyhOdH+ObFA 9JrBfuwTk97hni9GVOio40dRBIhz/BFnfG14oDU= X-Google-Smtp-Source: ADFU+vszOBlJVDWTcMHNzEsxfyfpeQKTyrljqHyd7x1+1XvEseLwvU+i97Q+I0RbON8blkzJK1ndxwUl3hgNQ6sLWRI= X-Received: by 2002:a92:c525:: with SMTP id m5mr2478835ili.146.1585124775391; Wed, 25 Mar 2020 01:26:15 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 25 Mar 2020 09:25:49 +0100 Message-ID: To: =?UTF-8?B?TcOhdMOpIEtvY3Npcw==?= Cc: "G. P. B." , Nikita Popov , PHP Internals List Content-Type: multipart/alternative; boundary="00000000000029761b05a1a99f90" Subject: Re: [PHP-DEV] [RFC] [DISCUSSION] Locale-independent float to string cast From: kjarli@gmail.com (Lynn) --00000000000029761b05a1a99f90 Content-Type: text/plain; charset="UTF-8" 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't cause any breakage since a workaround has already been in > place there (e.g. the > programmers use var_export() instead of casting) > - if a piece of code relies on the locale-dependent string representation > of floats then there will be > a BC break, sure, however I believe that code isn't very sensitive to the > change in the vast majority of the > cases since that data is for presentation purposes only. > I know it's for presentation purpose only, sadly it's not used for just presentation code. It's being consumed and parsed by automated imports that expect a format different than `3.5`, because that's how it organically evolved. Even when it was meant only for presentation, the consumer expected the `3,5` format and will keep expecting this until we notify them of a change (and then it will probably still take weeks before this is fixed on their side). A lot of code that I've encountered is stuff like: ``` $csv .= $product->getPrice() . ';'; // older code I've seen come by $product = get_product($$var5); $csv .= $product['price'] . ';'; ``` As much as I'd like to see this fixed and always give a `3.5`, sadly that's not the case if you use a different locale. Going through thousands of files to fix this, is not going to be an easy task, especially not as this is often old enough to not be usable by static code analyzers. > Or do you have other locale-dependent use-cases in mind? I am sure there > are some but I think the number of the situations where the change is > problematic is less than what it first seems. > No, this is the only issue I personally see with it. However, the impact could be severe enough to not be able to upgrade to a new PHP version in the foreseeable future, thus I would like to see an upgrade path, one that tells you where it would've gone wrong, instead of turning the behavior on or off. If I can gather the logs and thus find usages, I can pro-actively start fixing where this would go wrong. I'll take a performance hit over a breakage. Performance penalty would only have to apply if the locale is set to something we know will change the outcome. Maybe it turns out this is a small issue, maybe it's a big issue... I can't tell because it's either upgrade & break, or upgrade & work in the proposed scenario. Some breakage may take weeks to find out because scripts run periodically. I fully understand that you don't see this as a big issue, and I really wish I could say the same. I can't vote, so I can't change the outcome, please consider my use-case when moving forward, thanks! Regards, Lynn --00000000000029761b05a1a99f90--