Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:107066 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 63960 invoked from network); 13 Sep 2019 11:45:41 -0000 Received: from unknown (HELO php-smtp3.php.net) (208.43.231.12) by pb1.pair.com with SMTP; 13 Sep 2019 11:45:41 -0000 Received: from php-smtp3.php.net (localhost [127.0.0.1]) by php-smtp3.php.net (Postfix) with ESMTP id 401BF2D2022 for ; Fri, 13 Sep 2019 02:21:48 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp3.php.net X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: X-Spam-Virus: No Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp3.php.net (Postfix) with ESMTPS for ; Fri, 13 Sep 2019 02:21:47 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id g7so31422452wrx.2 for ; Fri, 13 Sep 2019 02:21:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=8bwsLN/3qY+kK9vLs0Cxucbc+YvUuJ/bl/7SI6yrbik=; b=k4X3p7cnQJLbFmTGpnlcPGJxvLrqMoRpfit3LevzY4+wcK0buCpf7P7dvSZlNBp1M9 3ZQVnmoRQO0dIAUHI0Ar/8ipXD6Wl1d2CKYiEUKkUADZ186MugQ7VRaE4BMoWFM6047A KYJrl6L/WumhaX3YHkwWRCOQlt/6x8KBF4cpDfOFLcCoIrEHL+kokjJoseHzUkwwkMDD 6OLb9Y5jShPkHvCaHZwjs1zzrTlhD7Omb+sEVidp8I5cf2GGGAzG0Nm4xCHZm88wLZ7i 0lJj+vxAVy8QHBajn+OLxhO1rXX5I3LuJ7bKaKq4Dpbg7XA4bGOxNpa3RbXdPyG4YGY+ RYZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=8bwsLN/3qY+kK9vLs0Cxucbc+YvUuJ/bl/7SI6yrbik=; b=WzZHFWEKtNiqTQ2ycQBdpRefOJSGKnwZu2HiJ32e82DPP1IfqHjbOxtm4sZe5JKAQ0 Liujg1RLK71gN217gijCx0ss5OD51Lg7k2B53P7TK6JmqyHs1LmsaU0A12QPu89cLXPa p+8+oEgzVpaPLw1HjLklehxLG6UKDTUxyqHIdGUhANRlw/ZmzICwPNyRRTwmvGRbX6kp jfh94IJJZ1TS2OM6aHvQvKDFePWN4OxdG2JVUlYuWENNWQwPZ/TCLIQ34ziP/KyqgEwX AaCBTYdzYwZkCxwx0UCtChUj9EojIZUx7EjWr1i3IAKlW8G4Mlt3fwt0bKp0j5Yps+M0 n11Q== X-Gm-Message-State: APjAAAUqElkfzE+Pk+q37jy4gMZy+IMtKTY8txA3raeD9kt0UJJRmUNy I0o3/AMcmlnNF/z7VVcYJ4h5eaeW X-Google-Smtp-Source: APXvYqzPSZMtQn9UGmkNoaJfSiJfr6sC4UoVLcDfH+QrSNg2clWiFaiukoTEmXEGnfLkpmGGa1UsNA== X-Received: by 2002:adf:f601:: with SMTP id t1mr3933519wrp.36.1568366506392; Fri, 13 Sep 2019 02:21:46 -0700 (PDT) Received: from [192.168.78.201] ([217.38.59.169]) by smtp.googlemail.com with ESMTPSA id o9sm35362013wrh.46.2019.09.13.02.21.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Sep 2019 02:21:45 -0700 (PDT) To: PHP internals References: <3c843963-176d-85c8-bf89-cc944640a7fb@korulczyk.pl> <0b4e8de1-5d3d-9646-49d0-6a2db41820d9@gmail.com> <4565840b-f732-99b0-de81-c386c433017c@korulczyk.pl> Message-ID: <99a346b7-b909-6ffc-a242-e865613430a5@gmail.com> Date: Fri, 13 Sep 2019 10:21:43 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <4565840b-f732-99b0-de81-c386c433017c@korulczyk.pl> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB X-Envelope-From: Subject: Re: [PHP-DEV] [RFC] Reclassifying engine warnings From: rowan.collins@gmail.com (Rowan Tommins) On 13/09/2019 10:02, Robert Korulczyk wrote: >> Why? If "assume $key2 exists as a key and is an integer" is so bad that PHP should halt my program, why should "assume $key1 exists and is an array" >> be perfectly OK? > Warning is triggered by reading non-existing key, not assigning value to it. In `$foo[$key1][$key2] ??= 0` you never try to read non-existing key. $foo[$key1] has to be read to determine if it's already an array, and if it has the key $key2, in the same way that in $foo[$key1]++, $foo[$key1] has to be read to determine if it's already an integer and what it's value is. If we're talking about being strict, we shouldn't limit ourselves to what happens to give a warning today, we should be consistent in our reasoning. So if the reasoning is that accessing uninitialised array keys is dangerous, I should not be able to mention $foo[$key1][$key2] if $foo[$key1] doesn't yet exist. Regards, -- Rowan Tommins (né Collins) [IMSoP]