Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110172 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 45071 invoked from network); 15 May 2020 23:25:50 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 15 May 2020 23:25:50 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 229C418058D for ; Fri, 15 May 2020 15:03:21 -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-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) (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 ; Fri, 15 May 2020 15:03:20 -0700 (PDT) Received: by mail-lf1-f46.google.com with SMTP id x27so2958375lfg.9 for ; Fri, 15 May 2020 15:03:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=swdDXG2Gy8A+vZ0Td2qDhg8wVDsoWi0L+uWJqVGuiY8=; b=ZcQBcmALiAiZLxqim4ryf5TRVCoLshPOwbaaS0HNtyTRehq4ixB2h238l4j3aDOJ5M 7XflWnMo0ZmLsp7ToObKOZEFOTy6d9cnkos8yLfk9p2aAK6IcImUuKJ0G83RVs55Dzdx fAIpzgEUmNQDHXzUkTJhNlU0oZ3vI7YBMCYI31GLUfQrC5V/pow7tXytULCizEygMs4G P+HgXkdP1TArpYKJrcFNSPv9rdywYWHHruvAcJ+ATIcdUksU59bL431VtEjD1LvXeuf6 YaVkwLOR3YCM8VSG3QcK8uRZ5gB//5B8xm2dmECWBAHiv7l7V1vr5RK1qIkcrRg/755G i/Ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=swdDXG2Gy8A+vZ0Td2qDhg8wVDsoWi0L+uWJqVGuiY8=; b=s7EjGGsBEewub/84s4PFwCVD26nybjT1oiJ9z+6Zrspo3AB+D+r+BF/6QIq7kVNpOf gEzPnf5hhEQ6wBOtVof+KtIb8wZUETNAsUiTfNqw0fNnvOtXYg8SqjgkOQxuU6kfcM5M R9rFpMvk4732usTg1NfQhQiZMEr9otxkZVuvUhKYkw85hemd5XYcdWRiERjZicV4YNcs QosaN9muSzjQxau+UB+A4KSdKx3DpxocWQfF0FNgv6JtOe5igiv7FQTWzm9jurt3J1zz KK9o+mIR3P1UFc2bNS9gSjBaPFBmGqGtDGaloMso5zskOP5xhf18+jfBQ/Y4DMUm+Bph Hxxg== X-Gm-Message-State: AOAM5316/j7w0KzHEXcdrmuvqGOtgLsvwbWgGQcGj7UTlODxtvkoPGJL Qs0V9AqzN8qUKGRGvbSFmc6RGO6VD/s7P1B14UrY6QJdEU0= X-Google-Smtp-Source: ABdhPJzvPTWfxb6Df9YhXRUt+wPEVi2eMsqpX4TzP3dkamCfOxSeD96DPIi7wMgU5PnGCdgAX66e44R7PlRWYprQVdE= X-Received: by 2002:a19:23d2:: with SMTP id j201mr1008917lfj.83.1589580197076; Fri, 15 May 2020 15:03:17 -0700 (PDT) MIME-Version: 1.0 Date: Sat, 16 May 2020 00:03:05 +0200 Message-ID: To: PHP Internals Content-Type: multipart/alternative; boundary="000000000000fd237505a5b6fa1e" Subject: [RFC] Strict operators directive From: arnold.adaniels.nl@gmail.com (Arnold Daniels) --000000000000fd237505a5b6fa1e Content-Type: text/plain; charset="UTF-8" Hi all, I'd like to restart the discussion for the strict_opterators RFC ( https://wiki.php.net/rfc/strict_operators). A number of changes have been made to the RFC since the last discussion. These are aimed at limiting the situations where `strict_operators` will change the behavior rather than throwing a TypeError. 1. Comparison operators >, >=, <, <= and <=> with string operands will throw a TypeError instead of behaving as `strcmp`. String operands on comparison operators are likely to result in unexpected behavior. However, the use case of comparing strings as numbers is too common to change the result of this comparison. Additionally, there may be issues with locales. Users should use `strcmp` or `Collator::compare` instead. 2. All comparison operators (excluding ===) on array operands throw a TypeError. This means it will not be possible to compare an array as an unsorted hashmap. While this distinction is useful, it's not well understood by most. The major issue is that it's tied into strict vs loose comparison. Allowing this would result in many cases where the operation results in `false` with strict operators while resulting in `true` without it. The alternative of throwing a TypeError based on the contents of the two arrays goes against the principles of the RFC and brings a lot of complexity. 3. Concatenation operation (using .) on null will not be affected. The operator will be cast to an empty string and no TypeError is thrown. 4. Variable parsing in strings specified in double-quotes and with heredoc is also affected. This removes the distinction between using the concatenation operator and variable parsing. With `string_operators` a TypeError is thrown when using a boolean, array, or resource in variable parsing. Arnold --000000000000fd237505a5b6fa1e--