Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130742 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id 185401A00BC for ; Sat, 2 May 2026 15:45:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1777736724; bh=MuAHljIv8DgSYmkmGKlCOgaJ4Y/G81J5A2KfAR5p+Pw=; h=Date:From:To:In-Reply-To:References:Subject:From; b=LF+bh8LQJtgNeCOC8TQpjwX2nvUP+KtHYL/RCFGEvzwK1FQVTVd7RL6ZLgBZbInWx D3qIdpxZ1nU4xDiVPfVCFVkDqOy0sNkM3JOy/Wtdu1LggD+ZJ8H+A0M9zmKoLQNI8p jbPKFecYVWf/McpiyxmEHifKRGXJqB3ahw6Zya3YhG5nLXMqhFBIKo4zJARfgsPlCJ 1RK51vmTYymT3hhBl4qgwwx9okPhAlCnBxHl7/BWCQR7zi1nlmv42EF+KCMF6P8EnQ G48or50nyY+NPCXZEJt/Hu7eMUmZG265mU76quNlsc/jEUvb17JXucJeWU8qYkAaty AYlfkNKdYvFWA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 75DFB18004C for ; Sat, 2 May 2026 15:45:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from fout-b1-smtp.messagingengine.com (fout-b1-smtp.messagingengine.com [202.12.124.144]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sat, 2 May 2026 15:45:23 +0000 (UTC) Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.stl.internal (Postfix) with ESMTP id C33811D0003B for ; Sat, 2 May 2026 11:45:17 -0400 (EDT) Received: from phl-imap-02 ([10.202.2.81]) by phl-compute-04.internal (MEProxy); Sat, 02 May 2026 11:45:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to; s=fm3; t=1777736717; x=1777823117; bh=0nnb0YTn3xOYAWu31wJnY 9h0uPRrCAc8cwOHVeIAG1w=; b=U9SB17nVML4XypakraBMPdxmoRyPn64MIsHbZ UF4oJHDACs+P9nG61gNVZrqEoHGMWbiw4RTCNW+QTfbKjt2iFpUiFdJO5RoSTwPN R31UuFUBafQ4XecfnC4iUqA2fM9Y6a5ugrSk+FLMZu8E6h82C4STX3ovNQ2UdI9z SupWZAlPL047GuhcSyA9u3Jr8YXRKWqDvTG3Y+E1tu8VdXXBcNDDtfyb0g09jGYa QUlPQdaa/f/MiG1fSX0pv+lpPUVkmM8Er1c3h2bLbcqmKF3lA24fxAvzJIfc01KF 2Duhv1xyQqrzIhH7JPKff/nUdKGJB+4J7JXCCP8S34zylgFgA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1777736717; x=1777823117; bh=0 nnb0YTn3xOYAWu31wJnY9h0uPRrCAc8cwOHVeIAG1w=; b=jcIKNsnigZ3EnZCBi TUXyExQGUoOczjCfuxg0rQLKMmrm/4t1PcQ5AU9NEqZDzepktTGSInK/7SwJWv4y cnfuE4n1IhkgzI/Dhka9Plx6WPfF4SaWL3GMalW7dgjzhF0375c2V3civ66k+SwI rJcYVJFfQwU/bry8wJXewmB80B/iPWLhdy8+/9A11JRTKrcF6oUYldhX6xxpTbc+ V1vsNxsZYwRQbwppSy7acxmULD6MWC4bSF6FWqBiNt+CR1EJ6SrquGYkW9Vc8jDd bsSFt7LLytkfLY/SpjPoC/G6fAkwl89F+brJPO9/qs/q2J+seNbyJa4SMm2dYT7E 0sbaA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgdelfeegjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefoggffhffvkfgjfhfutgfgsehtqhertdertdejnecuhfhrohhmpedfnfgrrhhrhicu ifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomheqne cuggftrfgrthhtvghrnhepuefgteeijeeuveffudelhffhtefhkeevtdeuvefgffdvfeei vdetgfehveetleffnecuffhomhgrihhnpehphhhprdhnvghtnecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomheplhgrrhhrhiesghgrrhhfihgvlhgu thgvtghhrdgtohhmpdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdprh gtphhtthhopehinhhtvghrnhgrlhhssehlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 0ADC6700065; Sat, 2 May 2026 11:45:17 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 X-ThreadId: AbemEeSNUtcV Date: Sat, 02 May 2026 10:44:56 -0500 To: "php internals" Message-ID: <524d2690-f231-4612-a4a3-2db1bb4158c8@app.fastmail.com> In-Reply-To: References: Subject: Re: [PHP-DEV] [RFC] __exists(), a magic method for distinguishing "missing" from "set to null" Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: larry@garfieldtech.com ("Larry Garfield") On Fri, May 1, 2026, at 4:37 AM, Nicolas Grekas wrote: > Dear internals, > > It's my pleasure to submit this new RFC to yours. > Please have a look and let me know: > https://wiki.php.net/rfc/exists-magic-method > > TL;DR: I'm proposing a new opt-in magic method: > > public function __exists(string $name): bool; > > It'd let userland tell "set to null" apart from "missing" on objects,=20 > it'd restore > isset() <=3D> ?? equivalence on magic properties, and it'd fixe GH-126= 95=20 > as a > corollary. It's forward-compatible as a regular method on PHP <=3D 8.5=20 > (probeable > via method_exists()), and would be magic on 8.6+. > > Cheers, > Nicolas Thanks for the very detailed RFC! > If it returns false, the fetch produces =E2=80=9Cuninitialized=E2=80=9D= (treated as null by ??, so y is evaluated). __get() is not called. What is y? Looks like a reference to a previous iteration of the text. The Sequencing section also doesn't describe the behavior when __exists(= ) isn't defined. Does it just skip to step 4? (Please specify in the t= ext.) Is the intent to eventually deprecate __isset()? The RFC it doesn't now= , but do you feel that is the eventual end-game, in PHP 10 or whatever? The big one: Should any parallel changes or additions be made to propert= y hooks? An exists() operation in addition to get/set, for instance? (= I'm not sure at the moment, but it should be thought through and discuss= ed, and if not, documented in the RFC.) --Larry Garfield