Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109509 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 65636 invoked from network); 2 Apr 2020 14:00:42 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 2 Apr 2020 14:00:42 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 24CF91804C7 for ; Thu, 2 Apr 2020 05:27:22 -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-f53.google.com (mail-ed1-f53.google.com [209.85.208.53]) (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 Apr 2020 05:27:21 -0700 (PDT) Received: by mail-ed1-f53.google.com with SMTP id a20so3873654edj.2 for ; Thu, 02 Apr 2020 05:27:21 -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=/mHyC0VqKYWLb6/ZoxdB2f9P5PWNtSbyDICqSbkBFq4=; b=e0Ibec6Gzgud6G/GcS1r4lRQK/6Lp47Ei1wOeLiZXpw0fXrMVuyefMFsaKnVVqcQf4 0LLOQxg3XwjVSZMXyPl8fYGLX8mqbYl+TmAnxekV6ChxNnFEwmomnDuJ9/i/Co7LccQU Y0ohDQjPJtKWGR8Hsl5g7G5O+jOvAEtQjh7axNTGv+r8qxfEzhMHYpTz9TE7hSC5Xf+F uZCyzVj4h6h3QnbazCyBTcNwyZGoIz5JQJgwYJft/h7t1Sv9Rn5TInPEqqgV+xmuRgwE Gd55is4Oq6CSqskMfJ/3bkKdNJlQAR3SDDF0tYPoQo3RBEMYSLoV3u7gyLjh+BqpmYR1 0AuA== 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=/mHyC0VqKYWLb6/ZoxdB2f9P5PWNtSbyDICqSbkBFq4=; b=JsxvbC9VeFrP3PPaZM6GvCMCqEBkf7D4nkPP59bspTjkpDZtGENfg9obcLJ5kuhr1Y NUy7/Dl3x8wRGm5qhb2YVnxjmTcMR3W5L3xcScQp3QG8SHxIp9PFFpL6k6JhoptOcuK1 20T/ZxNf1AAqqibC+SmNdIwFYJEMVlNUew+JDUnc1fdmwrpwAdE971sUaieccWkADXfh xIGLDyBZIsF9/TV0yC/rFcPEQ0qCTtYZEm87yK7d5cwAjp2LnAkvYXA7CSvYlX+k8NCN 1NB4WEPs81rsGXoAVDoz40lGZyD6FUFHGKOlw+r38Pgxd6wPVKAOq5jWyIdNmr6aGsku oH3w== X-Gm-Message-State: AGi0Puaf4au1Ty397/DhCwwR4gM2cJf5cegz4tcYRliUSJ6N62Ww46VQ c1TraBBHLiijsvBTluhK1xksW0Gw0eNDc+HC5Fc= X-Google-Smtp-Source: APiQypLwxLWo4iAHnRHCSBPDw373ZCQ970PnyDofmJ0GJu96panPvXb4kMGgjZoG0oH2JPhqPHXZWDtY0xt1l7c0IiQ= X-Received: by 2002:a17:906:298f:: with SMTP id x15mr2965250eje.380.1585830438821; Thu, 02 Apr 2020 05:27:18 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 2 Apr 2020 14:27:08 +0200 Message-ID: To: Nikita Popov Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000fae23405a24deb57" Subject: Re: [PHP-DEV] [RFC] Stricter type-checks for arithmetic/bitwise operators From: george.banyard@gmail.com ("G. P. B.") --000000000000fae23405a24deb57 Content-Type: text/plain; charset="UTF-8" On Thu, 2 Apr 2020 at 10:14, Nikita Popov wrote: > Hi internals, > > I would like to propose making the use of arithmetic/bitwise operators on > arrays, resources and (non-overloaded) objects a TypeError exception: > > https://wiki.php.net/rfc/arithmetic_operator_type_checks > > This is inspired by some of the recent discussions, in particular the > operator overloading RFC (where the fact that operations on non-overloaded > objects still succeed with just a notice was criticized) and the > increment/decrement RFC, which handles the array case of this proposal for > inc/dec only. > > I think as-is, this RFC should be completely uncontroversial. However, > there is an open question on whether we want to make this slightly more > strict, in order to align the semantics with the rules for weak parameter > type checks for ints/floats. > On this topic maybe it would be good time to bring back again the Saner string to number comparison RFC, at least in some form? https://wiki.php.net/rfc/string_to_number_comparison Or is this open question meant to replace it? And maybe in some other form revive this RFC about allowing trailing white-spaces in numeric string, because IMHO only accepting those which have white-spaces in front is kinda weird. > If we do that, then this RFC could be a stepping stone towards making > "implicit" internal casts use the (weak) parameter type checking semantics > more generally, which I think would be a good idea. The current explicit > cast semantics we use everywhere are too forgiving for most circumstances > (e.g. an array is almost always not a reasonable input where an integer is > expected). > > Regards, > Nikita > Other than this a solid +1 from me. George P. Banyard --000000000000fae23405a24deb57--