Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119139 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 18559 invoked from network); 13 Dec 2022 21:27:39 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 13 Dec 2022 21:27:39 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4BCC81804BE for ; Tue, 13 Dec 2022 13:27:39 -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,HTML_MESSAGE, 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-yb1-f182.google.com (mail-yb1-f182.google.com [209.85.219.182]) (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 13:27:38 -0800 (PST) Received: by mail-yb1-f182.google.com with SMTP id v71so19267396ybv.6 for ; Tue, 13 Dec 2022 13:27:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=X8fCIRC8KjvGuJMam+C1FXnvopgf0IfkPuzYG/8tjw4=; b=QM6FSp77muwp5IJfvbUBKqzvDyVVsx+S0LV401u7VNyqHf09beleRP8YrlR0MyU0Oo iomB5kfRXyGGbcD+02xWNgW7U45/kislY4UrBl9+B1VdnvbjA2uRB6CUKmJhaUZoR96B hTEzx2M7BAs90rtZcF5Nw4c+P/Q1me/e/v6neG2a/AJu5dIGyI0utBPwI41oOnucLLhs 3EQCTfifEBWVvUDK7uf+Ifo1WV5ZRnr/dNunEjchaJ2Xyyzq3lSvvO5dZU5bkTvlTB6a UnQskit6Le5YGk3xiRqK6ozdpxMBobSQdi62CVAhh9Ot0WzJ6YPVe1PxWnfu4aLxSoFg KxoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=X8fCIRC8KjvGuJMam+C1FXnvopgf0IfkPuzYG/8tjw4=; b=hpS4FJ1tVWbmAGzvPLouSFevVqx9KR893jCKqe904rtr7BrAtKpbyXqcfQmc1z/Dbh RCPluD9Q+WMDGF3zwcHwXC9VzLsXW++BoeKUVt6AgjUl5E7y/SKCLXEMSa6s+CLQNPgA af6KaqyXgfrVu9tImO/WspszPquWBXKhpoFwnGigAWYiIubghlyvkiyzFHQVP+FRHfuE HUVRNdDxtvx/ygqj8UzZV7unD2MAQQvgoBCzjXTjspw98wmG4UrItNEA9afVmzEb3Arr avtaMRPxyn5DyjVc8P468HvehGxgwe/YQsNNGq08kvoOumtUPEU4r9OJpJizd1gUkOWm UKeA== X-Gm-Message-State: ANoB5pmS3e8ckg63+N3AZfyi8R6dQUxr7wC+YrxlTA34hX3lY1JQjNiF hP/+j+7R2Hrg6XiYE96+xgVesNp9Q4/kr4HHoJSbNMkoIlM= X-Google-Smtp-Source: AA0mqf6ZcKvViI0VfRZq9hgeER9I9sE2ZffVQ7lQP03g2IuVT2dsq/lUe3SlmjcDoUxAppGncZrl2B0Uf8m/Jn8KATQ= X-Received: by 2002:a5b:285:0:b0:6dd:bd88:fedc with SMTP id x5-20020a5b0285000000b006ddbd88fedcmr73212598ybl.540.1670966857740; Tue, 13 Dec 2022 13:27:37 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 13 Dec 2022 16:27:21 -0500 Message-ID: Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary="000000000000fcb61005efbc497b" Subject: Re: [PHP-DEV] Revisiting RFC: Engine Warnings -- Undefined array index From: dliebner@gmail.com (Dan Liebner) --000000000000fcb61005efbc497b Content-Type: text/plain; charset="UTF-8" > Can you expand a bit on how you think distinguishing "undefined" from "null" would help? First off, I would be perfectly happy if undefined array/object index accesses went back to raising E_NOTICE. Undefined variables already resolve to NULL so in that sense NULL is already the "undefined" primitive. That said, if PHP were to introduce an `undefined` primitive, here's what I think would change: - NULL remains, and as such represents an "empty", yet defined, value. - Undefined variables and array/object accesses now resolve to "undefined" - `$var = undefined` is the equivalent of calling unset($var) - Biggest breaking change would probably be `$undefinedVar === null` is no longer true prop; // undefined, no error $undy->method(); // fatal error function($param = undefined) {} // fatal error // more difficult scenarios... // JavaScript would throw an error // classic PHP behavior would resolve to null, therefore now undefined // either is arguably valid, latter would create need for optional chaining $undy['key']; // ? $undy->prop; // ? --000000000000fcb61005efbc497b--