Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129552 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 10CCD1A00BC for ; Thu, 4 Dec 2025 17:00:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1764867619; bh=TSKTpZUMP2215qsJCay+3AIWkIIsjZY00q6fzs8L1KQ=; h=Date:From:To:In-Reply-To:References:Subject:From; b=F0fhXx1urwHYq1k9FQ2rDKwuQ35BX4CA+CzssxbO0dgk7bpMn4q3W4Lzf84h46siJ Mgfd71dYvo6HBGw2W5BZR3nMI78JJI28VNzmoDKZPdOx9uTfYW5oOq/UkPoPCIDUyS jacXL8ttk9tlOyS7SCd+nLspa9jI9Gjv0KmNxQ6mfrM3+qjRbj3E597VeZdJ3TUTp/ EEtcjM8YCxkN6mGj34mHtIT7qK79uTV+djKCyM66hxXM99h+Kn+0SKrimPkfOfo8jZ VG7CW+kTsoo98A2x52XDFZAc5A1JB51ekJrJbMBUQQV+H3F4PV8+rvfaj8h9NnLXIk eGxQNSbwokxWg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id EE4C9180056 for ; Thu, 4 Dec 2025 17:00:18 +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.9 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from fout-a8-smtp.messagingengine.com (fout-a8-smtp.messagingengine.com [103.168.172.151]) (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 ; Thu, 4 Dec 2025 17:00:18 +0000 (UTC) Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.phl.internal (Postfix) with ESMTP id 41A48EC05CA for ; Thu, 4 Dec 2025 12:00:13 -0500 (EST) Received: from phl-imap-01 ([10.202.2.91]) by phl-compute-04.internal (MEProxy); Thu, 04 Dec 2025 12:00:13 -0500 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=fm1; t=1764867613; x=1764954013; bh=JaWyWvZmUf4hxmG+nVwHX 9u5k0x6QBpqGqIyi24Rbk0=; b=MLMD3l0s7iKsu947heQedf62hWZMK+EEtectY 9yX4XYaERkMF2U4xMFjsoK0GwijWMOy/ik3y0SBblN78jxVhunuX6BzYaxGbDtH1 bvi+R5CXjWWwTWbHrN4uBTlPIyNkDYiy8Z1RdNHyvs38yKz/71f8Rip5BqiWsnZi 0YKwsS3lf1Uh1J3PMaXC+5Qj4HqndStSvD3HbjdMK8TjgpA9+lp8kaMrWwHXUqK9 YXfnrvOBe6wfTpjOz7C8ckENgQIJmo/h6nViLO6hSNDTUO2rUqcI8KcqjIz8w/7q mK44IE0VCDGNs9mQ3hNoydzU/hP95uJc39riv53SATJz1L8Yw== 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=1764867613; x=1764954013; bh=J aWyWvZmUf4hxmG+nVwHX9u5k0x6QBpqGqIyi24Rbk0=; b=OfmB0kfUZUfstCurg aPx0G+J0o3Zg36Cs7qOuHK+tKiKrSugaX6AlOUHvQ/fWazQKbz+E973PjYilCcV2 Et4yQRjWec5gNd2iobrE72xEBufFYhljHOSwIVlWxSbnYFgbcLUGpcTfkDuvoSKF 79atCY50NfYmmtr2lIl5v4c9wn57Bh08xzB52unaC+NZzEAfHTitKiUDSlGDjKZe TgvQOddadF5+fQHGbw5tDLIK2z4hwoul3xCHpBaw3YvukKSnGcbmj3e794YCoqJV IQ+GqqikV3uv8BG5T5/Ur2/XZ1/s8/vCuJSKpjscLGOQq+yhhP23V/xFEpWjfio3 Hu/yg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdeiuddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceurghi lhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurh epofggfffhvffkjghfufgtgfesthhqredtredtjeenucfhrhhomhepfdfnrghrrhihucfi rghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhmqeenuc ggtffrrghtthgvrhhnpeeugfetieejueevffdulefhhfethfekvedtueevgfffvdefiedv tefgheevteelffenucffohhmrghinhepphhhphdrnhgvthenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlrghrrhihsehgrghrfhhivghlught vggthhdrtghomhdpnhgspghrtghpthhtohepuddpmhhouggvpehsmhhtphhouhhtpdhrtg hpthhtohepihhnthgvrhhnrghlsheslhhishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 042E118C0066; Thu, 4 Dec 2025 12:00:13 -0500 (EST) 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: AboHCY4z1pNF Date: Thu, 04 Dec 2025 10:59:52 -0600 To: "php internals" Message-ID: In-Reply-To: References: Subject: Re: [PHP-DEV] [RFC] isReadable/isWriteable property reflection Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: larry@garfieldtech.com ("Larry Garfield") On Thu, Dec 4, 2025, at 10:47 AM, Nicolas Grekas wrote: > Le jeu. 4 d=C3=A9c. 2025 =C3=A0 17:39, Larry Garfield a =C3=A9crit : >> On Thu, Dec 4, 2025, at 8:05 AM, Nicolas Grekas wrote: >> > Le jeu. 6 nov. 2025 =C3=A0 00:28, Larry Garfield a =C3=A9crit : >> >> In other news, Ilija and I said a year ago that we'd take a swing = at adding isReadable/isWriteable methods to ReflectionProperty. Took a = while, but here we are. A strangely small RFC from us: >> >>=20 >> >> https://wiki.php.net/rfc/isreadable-iswriteable >> >>=20 >> > >> > >> > Thanks for this. >> > I also think the auto-scope is [NOT] a good idea. You state that 90= % of use=20 >> > cases will need this but my experience doesn't back this claim. The=20 >> > only cases where I had to check for read/writeable were out of the=20 >> > local scope, so I'd say 100% of my experience goes against that 90%=20 >> > number ;) Joke aside, it'd be just fine to let ppl be explicit. Tha= t's=20 >> > better than "oops I forgot to give the correct scope" bugs. >> > >> > About magic methods, one unsets a property only to have __get/__set=20 >> > called. Existing code works with this assumption. This means we hav= e to=20 >> > return true IMHO. Magic methods are just generic hooks also. Which=20 >> > means they should behave the same. >> > >> > Nicolas >>=20 >> Well, the only people who seem to have an opinion don't like "static"= , so we've removed it. RFC updated. >>=20 >> As for __get/__set, that's so far one vote for ignore (Tim), and one = for always-true (Nicolas). Not a consensus. :-) >>=20 >> Nicolas, can you clarify with an example if/how ignore would break th= ings? =20 >>=20 >> I think once we settle that question and the cooldown passes we're re= ady for a vote, though at this point that means January. >>=20 > > I can try to build a synthetic example but the gist is: > A class that starts with only properties and no __get() should be able=20 > to move to a __get()-based hooking in a later version without breaking=20 > code that uses isReadable(). > That on its own should be enough to settle the desired behavior :) So you want to be able to transition from: class Foo { public private(set) string $name; } To class Foo { private array $vals =3D []; public function __get(string $name) { return $this->vals[$name] ?? throw new Exception(); } } Is that right? Because both approaches would result in changes in some = situations there. If __get is ignored and the value is set, then a global isReadable check= will go from true to false in that transition. If __get always returns true and the value is still uninitialized, a glo= bal isReadable check will go from false to true in that transition. Either way, that's not a fully safe transition to make. --Larry Garfield