Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119118 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 60398 invoked from network); 13 Dec 2022 12:53:45 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 13 Dec 2022 12:53:45 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0551F18033A for ; Tue, 13 Dec 2022 04:53:45 -0800 (PST) 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, T_SCC_BODY_TEXT_LINE 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-yb1-f171.google.com (mail-yb1-f171.google.com [209.85.219.171]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 13 Dec 2022 04:53:44 -0800 (PST) Received: by mail-yb1-f171.google.com with SMTP id j206so17468028ybj.1 for ; Tue, 13 Dec 2022 04:53:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=OGXBwYz4o00CvGJgXIP7TcvtaEAYGrqrLRypyYZfCcs=; b=lMGfOomIls4N5DdIqxccih7sl27QTsFnG7qGFYR14tNkhWeKQyYd4G8y32lKxaJwfA TJhngQicyo8JK3AGSwiILK5RV2Wd0Woxbk26mdFynMYvONsttCAdsJLL/+q+xMbsr6fY tc0tb3sbCAxq9ekTwmY3Wh7Q7+z2FoQLb+ct8HKkD2KCUx7D6VHRW75HBM4913odPqKy PrlievTdBkbzpIMy3UjChsKmoGpGStuS2AgMc03KPYYgvmm90dcCI/MYkRENcSjg7lTc YmCxEE6TIOlta/RLeYf9V3KcVb9OaQHbr0H5GRviHk76VTEx5HdQZMyuHIugJApSW/9q 7D8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=OGXBwYz4o00CvGJgXIP7TcvtaEAYGrqrLRypyYZfCcs=; b=vc1YHPYG9/6+6uvKw16AOdTpTFVq4cuyYOKjFsQoKbgOAXOCBv62rKSJu2M7cr7x06 mvlDxKgGi7N4cqBGIklGRliDq4QB/zU3rizJf9AcdKPGlDvf2yd9/kGvJMos6g0uBSi0 mxng+qSSTKB08pkLS1B0uim97sRCXLhgdrs6J6CicNCp97pWdLaczsuzwAsaVG+pXFtg Z7458aAnAVVX8yDEuFdTZX59T4tOjfwrEgFpQKUxYS4swtPQRDF5BSXYpo5Ivj5L9X1Z PDYfSyYLCsUojvC1DQSjRWKzHedh0yhoC0xFI3puEv8b2BkPVpdNZ0xwRnSHKOu/GmmO Mtxg== X-Gm-Message-State: ANoB5pmRe3jWbFd+elKpyuTlgScgIrvJuTMRtKd+MHlopTA4Hci/untH 81xflXvm8lcig0ICg9TUByFik3RruhdFcdTtuDQ= X-Google-Smtp-Source: AA0mqf6/sk3KE7z0AAQoFPGcTK/L+fBSatKmaneA0RZSX5n2Yt0vc5UxFIWmChBBCWJtoJsPl7+0m9fMU+iXYx4nbC0= X-Received: by 2002:a25:7347:0:b0:702:9170:dcca with SMTP id o68-20020a257347000000b007029170dccamr15382195ybc.234.1670936018980; Tue, 13 Dec 2022 04:53:38 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 13 Dec 2022 07:53:22 -0500 Message-ID: To: Derick Rethans Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary="000000000000da95d105efb51b1d" Subject: Re: [PHP-DEV] Revisiting RFC: Engine Warnings -- Undefined array index From: dliebner@gmail.com (Dan Liebner) --000000000000da95d105efb51b1d Content-Type: text/plain; charset="UTF-8" > No, code doesn't break. It now shows a warning instead of an error. There is no behavioural change. It breaks my app. Does that count? And didn't you follow up by referencing this as "adding settings that change behaviour"? Does it change behavior or not? > Adding a configuration setting to make this a notice on some installations and not on others, would just mean that anything that needs to be able to run everywhere needs to take care to not rely on the setting either way, making it harder to develop portable code. What code now relies on this raising a warning rather than a notice that can't consistently deal with it by using isset or the null coalescing operator? Or are you subtly referring to the fact that this RFC is a stepping stone to escalating the severity to throwing an error? https://wiki.php.net/rfc/undefined_variable_error_promotion -> "This RFC proposes that accessing an undefined variable is rendered illegal behaviour in the next major version of PHP, and will result in an Error exception being thrown if it occurs." Here's another suggestion: Make accesses to undefined array keys (objects, variables, etc) return a new `undefined` primitive. That way, developers who are focused on writing concise, readable code can continue to write and maintain code manageably, and developers who are keen on writing a lot of code in a more "strict" manner can handle undefined array key accesses consistently, without having to rely on configuration settings. > just fix your code. Practically speaking, I'd much more likely stay on 7.4 or migrate to Node. On Mon, Dec 12, 2022 at 5:52 PM Derick Rethans wrote: > On 12 December 2022 22:20:27 GMT, Dan Liebner wrote: > > >It has been proposed to make the error level of "Undefined index" > >configurable so that teams and individual developers can decide for > >themselves how they want this situation to be handled. Given that: > > > > - PHP has been treating this as an E_NOTICE for over 20 years > > But not in the last three years. > > > - the change is a breaking change affecting many large codebases > > ubiquitously (unless one were to unadvisedly suppress E_WARNING errors) > > No, code doesn't break. It now shows a warning instead of an error. There > is no behavioural change. > > > - 7.4 is now deprecated > > Yes, as each release does 2+1 years. Which also means you've had 3 years > to address this in your code base(s) already. > > >I think making the error level of "Undefined index" configurable is a very > >reasonable suggestion, and I support it. > > Adding a configuration setting to make this a notice on some installations > and not on others, would just mean that anything that needs to be able to > run everywhere needs to take care to not rely on the setting either way, > making it harder to develop portable code. > > We're also not generally anything near keen on adding settings that change > behaviour , and suggesting to add one to make a warning a notice seems very > far short of a bar that needs to be reached before many of us would agree > to add a setting to make PHP less portable. > > Alternatively you can just fix your code. > > >Are we able to revisit this topic as a community and potentially bring in > >more PHP developers from around the world to weigh in? > > You're always free to follow the RFC process, but I think you'll just up > wasting your, and everybody else's, time with it. > > I can't see this being reversed, nor a setting added for, through an RFC > process. > > cheers > Derick > > --000000000000da95d105efb51b1d--