Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126506 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 qa.php.net (Postfix) with ESMTPS id 8BD711A00BC for ; Tue, 25 Feb 2025 22:51:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1740523747; bh=59AZZraf2Hy6MfPtOQT74XkxW33Ypq44wtT7KhfTGnA=; h=Date:Subject:To:References:From:In-Reply-To:From; b=FomFW01MK3SNwkIHFpMgY9JxkKP2hfUg0L+U+xYr+hZLFuln96ACsBmlrL4ZymQFK WWM/uJvo6DDSyxCjdQ2SXLkU3g37SXap1ogvjOJlj1oTQSm7F+go6MoL+XAa0FpuMA 5o3N0nHhijhuh6ceooBnBp8x6Gto7o3ygjrSsKuQBMCP2oOSrR8eOelU9A5SItNtgt Phx1DeqMa+v7vmZ4r8spb3MeetalAyONpe4BJB/p96+8g2Ck8Y3q04zhnroKr+CMUj P6S18Aela6vq8Ay0ckw/nI8rCKfBo16NZu/yDw7UCor8FL5KA2Q3kb/kxpqGqSP5ir dPRZ9kGladweQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4449D1801DC for ; Tue, 25 Feb 2025 22:49:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from fhigh-a3-smtp.messagingengine.com (fhigh-a3-smtp.messagingengine.com [103.168.172.154]) (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 ; Tue, 25 Feb 2025 22:49:05 +0000 (UTC) Received: from phl-compute-09.internal (phl-compute-09.phl.internal [10.202.2.49]) by mailfhigh.phl.internal (Postfix) with ESMTP id EBDA811400F6 for ; Tue, 25 Feb 2025 17:51:43 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-09.internal (MEProxy); Tue, 25 Feb 2025 17:51:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rwec.co.uk; 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=fm1; t=1740523903; x=1740610303; bh=hUpjC7BWfjQOqaBMt7/8NKKlkfPWdzZgSXloLFiEL3s=; b= qtnWogcT2obElsnASeSYoMxVT98X2XA0BemaBko4/RWW2Uf6eu0pU7aSNUCSxQTq l92g/LICgMZ0aGKLL2FlV5UtOIj7tFgJQZzgG2qU/ALE9PCFT9M8NOdYrbBAxhEm zMT3glvHMjokZGsuVVpQi9b28GmTNAdiUCiMS8oOlWv6PhIgNgy1dG00sHj9U2HQ +DIOOo3dO3aTjJZuMJLy0Z8oTI0zdd4KXdsNT3kZOzOPsf0yAyUkC4E+v3Wy0KzV WdKVW+zJIZeyq9u0Z4HyDs5DEot9XfLyWgIQQoYVeumfynN9+XqQf/BX8x5RYKqu sBwfDVh1w3+UwnYllKlxfw== 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=fm1; t=1740523903; x=1740610303; bh=h UpjC7BWfjQOqaBMt7/8NKKlkfPWdzZgSXloLFiEL3s=; b=NOWQ5FnmyxzdEN5Nv vKNJ7kfobUCkiJac5aM0Z5r1iDpwpAYLgbkW4QFtTRf7WUUFpfYxEWR4txH/ere7 jmtnOz03sPOxsiOCeQvy4BOtxFQe+BLsOaVUJwm3O/Cak1gRgyeiw6bw7LfofVXg XviOlfNWNv6+l2mIBCcTDe/XTs5d/c6s4Li29Y46J1UJ/k/+37P3X61IxQYpQQUi hlVicoPibj4ZXnrKRSMwTybzx9v4zEs2Vbxro1L1YegCdm3UlFWcIKIy2+ZnuKiK 4wYGs3ZBqLHUGRbuLtajNsA+1tzYKxI04nu5JZSm7zcqWXOX8TAEvBZubSCGCAoI JegTg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdekvdelhecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecunecujfgurhepkfffgg gfuffvfhfhjggtgfesthejredttddvjeenucfhrhhomhepfdftohifrghnucfvohhmmhhi nhhsucglkffoufhorfgnfdcuoehimhhsohhprdhphhhpsehrfigvtgdrtghordhukheqne cuggftrfgrthhtvghrnhepledugfeitdeiieegffdvudefgeevleeuudethedvgeegtdeg ueeltdduvefhjeejnecuffhomhgrihhnpehgihhthhhusgdrtghomhenucevlhhushhtvg hrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehimhhsohhprdhphhhpsehr figvtgdrtghordhukhdpnhgspghrtghpthhtohepuddpmhhouggvpehsmhhtphhouhhtpd hrtghpthhtohepihhnthgvrhhnrghlsheslhhishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Tue, 25 Feb 2025 17:51:43 -0500 (EST) Message-ID: Date: Tue, 25 Feb 2025 22:51:40 +0000 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] Consensus gathering: allowing unsetting of backed property hooks To: internals@lists.php.net References: <0b408765-04c4-49ed-bd5a-bceb34a2a3f1@app.fastmail.com> Content-Language: en-GB In-Reply-To: <0b408765-04c4-49ed-bd5a-bceb34a2a3f1@app.fastmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit From: imsop.php@rwec.co.uk ("Rowan Tommins [IMSoP]") On 25/02/2025 21:13, tight.fork3192@fastmail.com wrote: > Hello! I started GitHub issue requesting that property hooks be allowed to be `unset()`:https://github.com/php/php-src/issues/17922 > > While discussing in the issue it was suggested I pitch this to the mailing list, so here I am. Place me firmly in the "unset() is already weird enough" camp. I actually started writing an RFC to rationalise some of this behaviour, but gave up because it's such a mess. Here are some of the things that might happen as a result of unset($foo->bar): * Nothing at all, because unsetting a non-existent property isn't even a Warning * A dynamic property (not declared, but created because it was assigned a value) is deleted without trace * A property declared with no type becomes "undefined", and appears to be deleted (e.g. disappears from var_dump) ... * ... but retains its visibility (e.g. you'll still get an error writing to it from outside the class if it's private) * A property declared *with* a type (even if that type is "mixed") instead becomes "uninitialized" - it still appears in var_dump, and accessing it is an Error, instead of a Warning * An __unset() handler might be called ... * ... even if the property is declared, but is currently "undefined" or "uninitialized" ... * ... and that handler could do absolutely anything, including throwing an exception If we allow a hooked property to directly "unset" the backing value, what *exactly* will it do? And what if it's a virtual property, so there is nothing to unset? If we add an "unset" hook, what's the default behaviour if one isn't defined? I think it's one of those features that sounds simple when you look at a single use case, but actually specify the behaviour in all cases is going to be a lot of work. -- Rowan Tommins [IMSoP]