Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117095 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 90289 invoked from network); 21 Feb 2022 10:57:54 -0000 Received: from unknown (HELO localhost.localdomain) (76.75.200.58) by pb1.pair.com with SMTP; 21 Feb 2022 10:57:54 -0000 To: internals@lists.php.net Date: Mon, 21 Feb 2022 12:17:06 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 References: <67207814-3052-b116-e856-33e8440049d3@gmx.net> <153fc3b5-5409-44ad-b618-84297aa49a3d@www.fastmail.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Posted-By: 87.81.129.66 Subject: Re: [PHP-DEV] Setting to disable the "Undefined array index" warning From: marandall@php.net (Mark Randall) Message-ID: On 21/02/2022 10:29, Nicolas BADIA wrote: > and I don’t find the code more readable. Here are some examples of changes: The example changes you provide are what many people here would recommend as good practice to improve the context and safety your code provides. Anyone looking at that code can immediately infer that there is an expectation that those keys may be missing, with a suitable default provided for if that is the case. The engine can see this too, which avoids it emitting warnings. It takes a little more code, yes. But that is because you're being more clear in your intent. This is a good thing. You should keep at it. You could probably have the majority of your codebase converted before you could even hold a vote. Even if the vote was passed, which seems most unlikely, you would still need to wait 10 months for 8.2 to come out to use it.