Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:107062 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 55632 invoked from network); 13 Sep 2019 11:26:56 -0000 Received: from unknown (HELO php-smtp3.php.net) (208.43.231.12) by pb1.pair.com with SMTP; 13 Sep 2019 11:26:56 -0000 Received: from php-smtp3.php.net (localhost [127.0.0.1]) by php-smtp3.php.net (Postfix) with ESMTP id D70572D2006 for ; Fri, 13 Sep 2019 02:03:01 -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,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS57367 213.189.55.0/24 X-Spam-Virus: No Received: from cache4.mydevil.net (cache4.mydevil.net [213.189.55.195]) (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:03:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=korulczyk.pl; s=devil; h=Content-Transfer-Encoding:Content-Type:In-Reply-To :MIME-Version:Date:Message-ID:From:References:To:Subject:Sender:Reply-To:Cc: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=93KHYSmQ/MKjSujpmxHpiRkOUcrZfcSX2IxrzsopD2M=; b=J1ov180k4vm5w2tc5Yy/EmR2jN /evsTTqaTlw5EFkFzXCZ+8XLwR8TccyxtMT7lXyjzyYHRhvwWNH9xhQ/w9Ujm6SRBs66haansJQ2T yRbXIMQfF1L1ZFUlJ2xiZKL2rjfBnM5eLNF8gm1DhvzZisPenEU7xQcuT1P2dCN5lr1k=; To: Rowan Tommins , PHP internals References: <3c843963-176d-85c8-bf89-cc944640a7fb@korulczyk.pl> <0b4e8de1-5d3d-9646-49d0-6a2db41820d9@gmail.com> Message-ID: <4565840b-f732-99b0-de81-c386c433017c@korulczyk.pl> Date: Fri, 13 Sep 2019 11:02:57 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <0b4e8de1-5d3d-9646-49d0-6a2db41820d9@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-AV-Check: Passed X-System-Sender: robert@korulczyk.pl X-Envelope-From: Subject: Re: [PHP-DEV] [RFC] Reclassifying engine warnings From: robert@korulczyk.pl (Robert Korulczyk) > 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. > Please can you show me a bug that adding this line has avoided? I don't doubt that the same warning saves bugs in other scenarios, but in this > scenario, the logic is unambiguous, and any additions are just to suppress unnecessary errors. Well, then let's say that it is "lesser evil" - one additional line is better than ignoring reading uninitialized values. And IMO it is not a "problem" that would justify introducing special syntax for saving one line in such niche case. Regards, Robert Korulczyk