Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119113 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 42378 invoked from network); 13 Dec 2022 10:02:02 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 13 Dec 2022 10:02:02 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9D5AC180054 for ; Tue, 13 Dec 2022 02:02:01 -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=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,MISSING_HEADERS, 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-oa1-f44.google.com (mail-oa1-f44.google.com [209.85.160.44]) (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 02:02:01 -0800 (PST) Received: by mail-oa1-f44.google.com with SMTP id 586e51a60fabf-144bd860fdbso11969727fac.0 for ; Tue, 13 Dec 2022 02:02:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Y1p2BIaEO35a0kYDERnSidVAfBb3I2ds07NBQt92Bm4=; b=TnX65umgZeTws0WFM7qAW7uguVQj99LMRn8Ln3Ui0gV5CcAD3obwUiB/k2pswX1iAo AdUWoqhwZ5ryAi9J65J1mftWa6oBSs+TaFkJH5Re1stlkZ9UnGS6YHm6MiKRdHzpiAsI 6xgeYlHL/pe6A1se1AjEjAxjx8CzKwptFxV6yphgv1lwTEJ/oUSKkQyMtk/vI0OgVcEI wkRLGP7IGqJdicGt2dnxqi99QAKH1x2dV0citGFIJdRid+kqlTVulIKHSgihIXAGMPMO hbvDZ54H8WW4/YT0f1a/FtD7/phfo7ZnVfDBNx4jeGTsYjZrpHZ8CzNfGf6pefpVwk9w qlSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc: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=Y1p2BIaEO35a0kYDERnSidVAfBb3I2ds07NBQt92Bm4=; b=X0okKTVWjHWCVhnjcFHo2uMvCnvjLhjvAL5HiO+12m8kZwaJpNdbbUTMBP+NLCcqL+ sAOqTx2DSnqD5dNoDP2SENaExGp6UpK/A4ViqjsHySXLb85XjRUGBPYHd6iXDV7UwmtP 795MCat4+4mUwLYvkJAAE7NKaB0HARngpQLDCmmCzU36nj6CDkTuuLG92fR6fN9eHNq9 r3uHWoJx4MoErrn3BF5TtAg1y+kkFEaWw5g7F7Z4Y4KAPHr7rQHOzf/CR8wrdNyQtRFY XxvF2WgqdbOKJfWVlreowsIiGbW3C1+ODqy4og+sl+b1WDmvdLqRDCzEoc1BpAjMiuJz RDWg== X-Gm-Message-State: ANoB5pl+bPCD5IUjHR4+Vf0GHJFBSJBp5OSs1EQBdazQdaNgFX6pUc+/ Rw2PYWCssukPtM4h+QOZOntOwf8wQcM5vpFWA3h/gF8lnX43mtCW X-Google-Smtp-Source: AA0mqf6hoOpZiN7sy5Bs5Tm6l5U/YyfyA5T6hsLartzKTykt3HGR4JK/dBefIH3ABLvDRz7a6Li30LDpoPY1u1KL850= X-Received: by 2002:a05:6870:5785:b0:13d:51fe:3404 with SMTP id i5-20020a056870578500b0013d51fe3404mr161729oap.183.1670925720226; Tue, 13 Dec 2022 02:02:00 -0800 (PST) MIME-Version: 1.0 References: <5fe0d8a9-d305-9c9d-ca36-1ca30de87b78@cubiclesoft.com> In-Reply-To: <5fe0d8a9-d305-9c9d-ca36-1ca30de87b78@cubiclesoft.com> Date: Tue, 13 Dec 2022 11:01:48 +0100 Message-ID: Cc: internals@lists.php.net Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Revisiting RFC: Engine Warnings -- Undefined array index From: landers.robert@gmail.com (Robert Landers) On Tue, Dec 13, 2022 at 12:36 AM Thomas Hruska wr= ote: > > On 12/12/2022 3:52 PM, Derick Rethans wrote: > > On 12 December 2022 22:20:27 GMT, Dan Liebner wrot= e: > > > >> 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. > > PHP 8.x is only starting to roll out in Linux LTS distro packages at the > end-user level. I've moved to 8.x internally but I am, in particular, > waiting for Ubuntu Server 22.04.2 to officially drop before beginning > meticulously planned upgrades to mission critical systems. I suspect > many people are in a similar holding pattern who are currently running > packaged 7.4.x and are just now discovering all of the changes for PHP > 8.x as they are planning out their system upgrade paths in the coming > months. While you probably wish everyone marched in step with > PHP-latest, that's simply not feasible in reality. > > The type of post that the OP sent to internals is likely to become more > common in the next few months as PHP 8.x starts rolling out globally. > Most businesses are waiting for at least the holidays to conclude before > performing any major system upgrades if not longer for specific OS > releases to drop. > > -- > Thomas Hruska > CubicleSoft President > > CubicleSoft has over 80 original open source projects and counting. > Plus a couple of commercial/retail products. > > What software are you looking to build? > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > Hello all, > The recent change to elevating "Undefined index" from E_NOTICE to E_WARNI= NG > set forth and passed by https://wiki.php.net/rfc/engine_warnings to me > seems antithetical to what PHP has been and what has made it a choice for > developers over the last few decades. From my perspective, in the last few years, it seems that PHP has been trending towards "preventing dev mistakes" over anything else. IMHO, this has prevented us from getting some really nice language features, such as operator overloading (because "devs might make mistakes"). I think it is worth pointing out that PHP has always had this kind of interesting dichotomy towards letting devs do what they want and preventing them from doing 'bad' things. For example, even though you could divide by zero you could never create a socket with AF_PACKET and send raw IP packets from PHP. Is this a bad thing? I don't know, but it's interesting to watch the language evolve and so far the changes have revealed hidden bugs in existing code bases, at least in my experience. However, fixing those bugs has been a nightmare because some of them have been there for 10-15 years. Ancient silent bugs are suddenly showing up and you have to make a hard call on whether to fix the ancient mistake or keep the broken behavior. It isn't always a simple decision and may often be a business decision vs. a technical one. Interestingly, with the array access warning, you now have to write much more boilerplate code just to do something that was once the default behavior. Not only does this require much more typing, but it also introduces much more cognitive load as you have to figure out whether a key has been set before (or be defensive, which introduces potential performance implications). Even then, using ?? on array access can introduce more bugs than it is meant to prevent. Most devs find out the hard way that ?? has an unintuitive order of operations: typed: $a['foo'] ?? null || $a['bar'] ?? null intended: ($a['foo'] ?? null) || ($a['bar'] ?? null) Further, writing code like this increases the number of opcodes needed to perform relatively simple logic by ~150%, increasing end-user latency and spending CPU cycles somewhat needlessly. Personally, I'm a fan of some of the changes made to the language, and I look forward to PHP's future. I hope this "preventing dev mistake" mindset is just a phase though because, IMHO, it really has held back some fantastic proposals that people put a lot of time and effort into. It's also caused us to have to write much more boilerplate code for a debatable benefit. Anyway, as an outside observer, that's my 2=C2=A2 on the matter. Robert Landers Software Engineer Utrecht NL