Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111114 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 2264 invoked from network); 22 Jul 2020 14:26:16 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 22 Jul 2020 14:26:16 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0F006180088 for ; Wed, 22 Jul 2020 06:20: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=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from darkcity.gna.ch (darkcity.gna.ch [195.49.47.11]) (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, 22 Jul 2020 06:20:41 -0700 (PDT) Received: from flatter.home (unknown [IPv6:2a02:1205:34fb:29c0:3166:e35:e8a3:124f]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by darkcity.gna.ch (Postfix) with ESMTPSA id 179776C0EB5; Wed, 22 Jul 2020 15:20:38 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.1\)) In-Reply-To: Date: Wed, 22 Jul 2020 15:20:38 +0200 Cc: PHP internals Content-Transfer-Encoding: quoted-printable Message-ID: <5CC11248-EB38-4488-B847-15623BEF8BA6@cschneid.com> References: To: "G. P. B." X-Mailer: Apple Mail (2.3608.120.23.2.1) Subject: Re: [PHP-DEV] [RFC] [VOTE] Saner numeric strings From: cschneid@cschneid.com (Christian Schneider) Am 16.07.2020 um 16:18 schrieb G. P. B. : > I've opened voting for the Saner Numeric strings RFC: > https://wiki.php.net/rfc/saner-numeric-strings Looking at the BC section I stumbled across > Code relying on the fact that '' (an empty string) evaluates to 0 for = arithmetic/bitwise operations. which is elaborated further down as > The third reason already emitted an E_WARNING. We considered = special-casing this to evaluate to 0, but this would be inconsistent = with how type declarations deal with an empty string, namely throwing a = TypeError. Therefore a TypeError will also be emitted in this case. The = error can be avoided by explicitly checking for an empty string and = changing it to 0. but now I'm a bit confused what is meant by "arithmetic/bitwise = operations". I assume this applies only to things like substr("foo", "") but not to = arithmetic *operators* like 42 + "" because that doesn't currently = trigger E_WARNING AFAIK. Maybe this should be clarified? Regards, - Chris