Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110775 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 84133 invoked from network); 29 Jun 2020 14:12:31 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 29 Jun 2020 14:12:31 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 52CB11804D3 for ; Mon, 29 Jun 2020 06:01:12 -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_H3,RCVD_IN_MSPIKE_WL,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-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) (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 ; Mon, 29 Jun 2020 06:01:11 -0700 (PDT) Received: by mail-ej1-f54.google.com with SMTP id w6so16485640ejq.6 for ; Mon, 29 Jun 2020 06:01:11 -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=JcSnYDpzA9DtO2cpEd/PwKXDV9ZDeIWg9dK/Yv5ZP0I=; b=qVIUZGjl+IczszTVl0c/taVBKt5yeqtpoauoOS4PpvV7jVZRZZL23daB52tbXj+myt ELbKQmOMIqVmidyJkIbxmkYcXpXl9r3dKusNdIaqGErCUMuqRnvJtXJCLT3IdP4nT2dS UXYcl8aacjip8uRNcv+T9zElE8hvzQmJG9RqKpDBVMfaqlWVuPjSjUQgHyj9rsI/ax+C 0YQ/wgtKGEAz6Xu9JwqME6xynTH9+YmEg3CJPmfwYdg1siXwqiCmpcC5x3W3GPpEJx4s JnaOgfi7Vljk6/AMKSjhQxeBslWUVC12dvGEJJZKX5f+WFh5WcJnKf4eZw4dz9IJxiqD bxVg== 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=JcSnYDpzA9DtO2cpEd/PwKXDV9ZDeIWg9dK/Yv5ZP0I=; b=KuoqcaC16jRi2UmiUqHX7Pw8KhKsoOfczfQY+oq1HHdcG8C+ZTGfdM35GjagJoPZFd ajiVJaez+g6ptXDjPiV0xShf6H0zzLbMBhfc4HETYXz1dNbgVg6zx214ShMDa2rHQTvx /dsib8yLPYZSL9vmjoess5YvNZyapNRdV5BUyL1Z8rCR5l0sAiYTTSTEWaJ9x+SWUMBL 46vsBENY592YYgirdylTi1+0/Dxf9lu+YZ8187APY6pfNDmlXbWLj/Lc2Gbuhv3JAJ// ir/g484PoOaxy/fYbhqydrvh8DDz3FJbqMm9mSze1PrbY+k+Y0WUVd3WPlgeQG1dM+5e Lfbw== X-Gm-Message-State: AOAM530btQS3DhgK6sHCKyDU2lEem5S7ezjsz3a13RUhyUDqUKjo4YW5 WZc+WBHrKS6Y3JiPtaBsl85K7wAPrxZHWOsGk8eGJoS3 X-Google-Smtp-Source: ABdhPJzVIs1CKI8P462NRClxepQLz0Tu97iCYGCbaFpKjPV3pJLfBSAJHM8AWwVHF2CjC9yMr3j9wM6+uJWfd6xAzyY= X-Received: by 2002:a17:906:f101:: with SMTP id gv1mr9125438ejb.327.1593435669199; Mon, 29 Jun 2020 06:01:09 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 29 Jun 2020 15:01:00 +0200 Message-ID: To: Claude Pache Cc: PHP internals Content-Type: multipart/alternative; boundary="00000000000008feb105a938a78a" Subject: Re: [PHP-DEV][RFC] Saner numeric strings From: george.banyard@gmail.com ("G. P. B.") --00000000000008feb105a938a78a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, 29 Jun 2020 at 14:53, Claude Pache wrote: > > > Le 29 juin 2020 =C3=A0 12:30, G. P. B. a =C3= =A9crit : > > > > Greetings internal, > > > > While reviving the "Permit trailing whitespace in numeric strings" RFC > [1] > > I didn't see Nikita's comment on Andrea's original PR which commented o= n > > the fact that we should get rid of the "leading-numeric string" concept= . > > > > Therefore, mostly due to time constraints, I've merge the trailing > > whitespace RFC with the removal of this concept in the following RFC: > > https://wiki.php.net/rfc/saner-numeric-strings > > > > The main gist is to convert all E_NOTICEs =E2=80=9CA non well formed n= umeric > value > > encountered=E2=80=9D to the usual E_WARNING =E2=80=9CA non-numeric valu= e encountered=E2=80=9D and > > allow trailing whitespaces, which would be most reasonables cases where > the > > E_NOTICE has been emitted. > > > > This RFC is heavily based on Andrea's original RFC [1] and I would like > to > > thank her once more for the preliminary work she's done that I could > reuse. > > > > Best regards > > > > George P. Banyard > > > > [1] https://wiki.php.net/rfc/trailing_whitespace_numerics > > > Hi, > > It is not clear for me, by reading the RFC, whether or not the behaviour > of either implicit or explicit conversion of so-called leading numeric > string will be preserved, beyond some Notices that will be converted to > Warnings in the implicit case. For example, does (int) "2px" still produc= e > 2, even when the string is now considered as non-numeric? > > I think it is important to make sure that the current results of casting > to int/float will not change. For example, I can imagine some script that > reads a CSS value like "2px" and does some calculation on it, converting = it > to a number on the process. A Warning instead of a Notice will prompt the > programmer to add explicit casts, which is probably a good thing. But > changing the casted value to 0 would lead to bugs that are (1) harder to > detect especially if the program already uses explicit casts, and (2) > harder to correct. > > =E2=80=94Claude > The behaviour of explicit casts (or any other conversion which accepts errors in the string, which corresponds to the 1 mode of allow_errors in the relevant C is_numeric_string function) will be preserved, so this should still produce 2. I will add test cases and clarify this in the RFC. Best regards George P. Banyard --00000000000008feb105a938a78a--