Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110818 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 14330 invoked from network); 2 Jul 2020 13:16:17 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 2 Jul 2020 13:16:17 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 479C91804CE for ; Thu, 2 Jul 2020 05:05: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-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) (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 ; Thu, 2 Jul 2020 05:05:41 -0700 (PDT) Received: by mail-ej1-f43.google.com with SMTP id ga4so29107727ejb.11 for ; Thu, 02 Jul 2020 05:05: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=/SsjPtRm+KOSPjBZFG8OHUE9s/Gg7+aaHaHvj6a6YMQ=; b=GN8NC9gA9nUN9R888NH8BNwYdKy8+18DKRaAV1csd94GWmdQyzvwAfYG07WaR8ztqi laLyEj4O2FXf1vT8JN8nCr/tngaByMobtCHE7lycgv32M/mTiTy1bTaeJP661ZZFFy2A USUH2TrGC/9CV4W07eBzCAix+7Pc0dGOg9RT57dKRSodekmmtWiUUlRdPHi4QQK6gYnk NHyqrTwyWtWpw1JrqYbUVpaMpE+zpV+Uw0e4jUiK/COJeYWL16bfATzxlfm5JoWRTJ2R kUwOCJ2RKvSVLLYfJOymSFzphOBr1nM4YUit/aMutINIoAfaYIERJSAv6DUNzs6F2CsJ docA== 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=/SsjPtRm+KOSPjBZFG8OHUE9s/Gg7+aaHaHvj6a6YMQ=; b=M3Qw+LOTp78hG0nzilXRU4qKSUMS2MRv9TXVIqysCFscV6JtGz1ALuVHgAnFLwGazh HCAUG9/HWtq9xquAXQe1qFnpqRjKha4tGyP/ARU0r5EugbBK9PfECxLUsnulJNsLTzCm 0diF1efjP4EaTAnv27oRqSKgMpRm2zb7NR2i2hdf6H9nV6PsRy7XqFf/hL6ANw49TmS4 8f9Djq7+4w6oXHPmZUtytqT3OiBlRHNVGC9OmEU4PHLw2P3JgUF2iPmxsqfjy6Z/pKrC tVp+z94cMB3/iZwk1CYwJjepm9hKnwA6dRcfUo2bVtqsrhXtRiOMTcXxs4dnTn9BMcC5 EXjw== X-Gm-Message-State: AOAM53214ElkMlCSk7tVsHFjGhJ20V1qJ9JUsvFUwDpO5sDO1jIEue6h yehK+/nW+JZ/RFQWo55NuXBxNB8w324yuM3+Xt0= X-Google-Smtp-Source: ABdhPJw/6+kicfRGd9pOforieGummPSC+PGMOW4I6tF4Uef5RkjFnZIOX4QAs4VNAIrc3tSbXB5vimDR1FdfSHrsoXI= X-Received: by 2002:a17:906:c30b:: with SMTP id s11mr28328152ejz.263.1593691539963; Thu, 02 Jul 2020 05:05:39 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 2 Jul 2020 14:05:28 +0200 Message-ID: To: Rowan Tommins Cc: PHP internals Content-Type: multipart/alternative; boundary="0000000000001f046005a9743ac5" Subject: Re: [PHP-DEV][RFC] Saner numeric strings From: george.banyard@gmail.com ("G. P. B.") --0000000000001f046005a9743ac5 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, 1 Jul 2020 at 18:44, Rowan Tommins wrote: > Hi George, > > On Wed, 1 Jul 2020 at 15:26, G. P. B. wrote: > >> >> 2. Emit the E_WARNING "Illegal string offset" and evaluate to 0 for >> offsets like '2str', and emit the E_WARNING "String offset cast >> occurred" for float numeric strings like '2.5' > > > > I'm not clear how this option fits with the rest of the RFC; there's no > explicit mention of evaluating values to 0 which would previously have be= en > evaluated differently. That would fall into the most significant category > of BC breaks: working code in version X still works in version Y, but > produces different results. > > At the moment, the "Backward Incompatible Changes" section just says: > > > code with liberal use of leading-numerical strings will need to be > updated > > It would be good to expand that with examples of what such code would loo= k > like, how it would behave before and after, and what updates the user wou= ld > need to make. > > Regards, > -- > Rowan Tommins > [IMSoP] > I've had another thought about while I was implementing this change. I've updated the RFC to reflect what I think is a more reasonable approach: > For string offsets accessed using numeric strings the following changes > will be made: > > - numeric strings which correspond to well formed floats will emit the > more usual =E2=80=9CString offset cast occurred=E2=80=9D warning inste= ad of the =E2=80=9CIllegal > string offset=E2=80=9D one. > - leading numeric strings will emit the =E2=80=9CIllegal string offset= =E2=80=9D > instead of the =E2=80=9CA non well formed numeric value encountered=E2= =80=9D notice, and > continue to evaluate to their respective values. > - Non-numeric strings which emmited the =E2=80=9CIllegal string offset= =E2=80=9D > warning will throw an =E2=80=9CIllegal offset type=E2=80=9D TypeError > > The only aspect I'm not totally convinced is making well formed float strings more "legal" than they were in PHP 7.x. I will also flesh out the RFC with more examples and which code is affected and how it would need to be updated to produce the previous behaviour. Best regards George P. Banyard --0000000000001f046005a9743ac5--