Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129766 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 E1AC61A00BC for ; Fri, 16 Jan 2026 17:49:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1768585773; bh=CDCjq0LFZfZpgT/FxwdkDO/+n3+1gZC77xTQ9R/fE1I=; h=Date:From:To:In-Reply-To:References:Subject:From; b=Fv+eLdCjfCDKEg6HImaaFmgCvYosMRAHCPyYpLQricr7Cg4wpFvy54aJdreUrP1MS P3A6ytPL9aXwQujyL59ANWcy6rV2QyDYtTxfGOtkdtB5ebhGTIeB5kuTBzt6iLqE9V 9r0+FJ62WjXB0Vwdbd1otgNLHbhocb8Nq9ubXdh2wZuKq++VWBG6Izj3e+AOuw68yg Q2Z5FfZ9fzioXvCHNc5EU9J7X9rZg95Sx2Tl8xoCVV1yL0o5wY2XBfDwWRhQHH6f8P BCIS3ni5hEXZRR+aDUiqvNj3JkWCAD/Mx/B/4pIfv5dXxAxL946tKY50VsRB34KF5i CV4BhDf63Ix9w== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7FCBD180088 for ; Fri, 16 Jan 2026 17:49:32 +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, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from fout-a1-smtp.messagingengine.com (fout-a1-smtp.messagingengine.com [103.168.172.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 ; Fri, 16 Jan 2026 17:49:32 +0000 (UTC) Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.phl.internal (Postfix) with ESMTP id A4E92EC00D4 for ; Fri, 16 Jan 2026 12:49:26 -0500 (EST) Received: from phl-imap-02 ([10.202.2.81]) by phl-compute-04.internal (MEProxy); Fri, 16 Jan 2026 12:49:26 -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=fm2; t=1768585766; x=1768672166; bh=+ChwORykmK69RPXlBTWm9 wf1/88kikseJVWWThDLW0Y=; b=ZsJTyc8MSUe2g3/TR3ERFBrG89A/XcAiU8Ewp K1vBz0ByL1TaQDFresAviI+hM7zogorCwN6tyLCsOCeW3bg9gx35SoVFgEpHYZkK Dt68vsYfPME90PyrprNGAC5/yakl0Do763E9iI2/wslqs/1b9hkUCGdAlcmKKnpy ta+bnSmUcZrhzkvmpLp3x25SdQTj91/jkN0dq4MleBsMQOV3SO2N/8HRgnWf9IDC IPB3SPprh9uAMGpAWAp4z1QxhHWl6LqdqTd1ZOxdt+6gBt+XlpuDs1PiSqgYUdeK xpnHlXxKCZjknU8VG3LO9PfYVCxWIW4Dqp/OjQaNc50Yho5cQ== 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=fm2; t=1768585766; x=1768672166; bh=+ ChwORykmK69RPXlBTWm9wf1/88kikseJVWWThDLW0Y=; b=l3jNanfx5J+H+o3zA BxA5BKoiVae9g95uE9eiB9SodeLUwBYH2jKgKz6Wh8doAD2fAHwuD9LD35ajRUVB K9pGzB+5mP86JXrCGmoeA9Ireuwtf482M4xaTdMKwmldHzitd8QzbsGSESPGKO/M 6NaXeONn7GwT6FsBxZigQoVzSWpK6/OXzqW0ni6gRot1bei9RCmzKeEIsT9xkdw8 R+ayGeYPfTEza6cquaICDpmv139qZ2NN4bMRV8I80BVMDhhSWEb+RLAwz41wc3Fj aGwYOXxOXVKV/Eyr10U2ZGqzUyzgKaUn9sc3A8PLBBRFI7Vz/J9bb5nWj7v2W7X0 rtPsg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdduvdelheekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepofggfffhvffkjghfufgtgfesthhqredtredtjeenucfhrhhomhepfdfnrghrrhih ucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhmqe enucggtffrrghtthgvrhhnpeeugfetieejueevffdulefhhfethfekvedtueevgfffvdef iedvtefgheevteelffenucffohhmrghinhepphhhphdrnhgvthenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlrghrrhihsehgrghrfhhivghl ughtvggthhdrtghomhdpnhgspghrtghpthhtohepuddpmhhouggvpehsmhhtphhouhhtpd hrtghpthhtohepihhnthgvrhhnrghlsheslhhishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 363E5700065; Fri, 16 Jan 2026 12:49:26 -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: Fri, 16 Jan 2026 11:49:05 -0600 To: "php internals" Message-ID: In-Reply-To: <352B0914-68EE-480B-895F-D7CB767A15B3@gmail.com> References: <352B0914-68EE-480B-895F-D7CB767A15B3@gmail.com> 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 Wed, Jan 14, 2026, at 2:00 PM, Claude Pache wrote: >> Le 13 janv. 2026 =C3=A0 22:30, Larry Garfield a =C3=A9crit : >>=20 >> On Wed, Nov 5, 2025, at 5:24 PM, Larry Garfield wrote: >>> In other news, Ilija and I said a year ago that we'd take a swing at=20 >>> adding isReadable/isWriteable methods to ReflectionProperty. Took a=20 >>> while, but here we are. A strangely small RFC from us: >>>=20 >>> https://wiki.php.net/rfc/isreadable-iswriteable >>=20 >> Hi folks. >>=20 >> The holiday blackout period is over, and there's nothing else really = to discuss on this PR, so consider this an Intent to Vote notice for the= isReadable RFC. >>=20 >> I'll call the vote later this week, baring any new serious constructi= ve feedback. >>=20 >> --Larry Garfield > > Hi, > > The RFC says:=20 > >> To use =E2=80=9Cmy current scope,=E2=80=9D the `static::class` constr= uct is an easy way to specify =E2=80=9Cwhatever class this code is runni= ng in.=E2=80=9D > > The code is running in `self::class` or `__CLASS__`, not in `static::c= lass`. Hm, good point. I've changed to to `self::class`, which I believe shoul= d only be an Editorial change. (There's no change to the design, just t= o the explanation, and it's arguably a typo.) I'll give it another day = before opening the vote just in case. > As noted in the RFC, `isReadable()` will give unavoidable=20 > false-positives (returning `true` although attempt to read the propert= y=20 > will error). But there is also a false-negative: > > ```php > class C { > > function __construct( > readonly private mixed $foo > ) { } > =20 > function __get($x) { > if ($x =3D=3D=3D 'foo') { > return $this->foo; > } > throw new Error('Undefined property '.$x); > } > > function __isset($x) { > if ($x =3D=3D=3D 'foo') > return isset($this->foo); // not `true`, otherwise=20 > `isset(new C(null)->foo)` will return an incorrect result. > } > return false; > } > } > > $c =3D new C(null); > > // will return false, although it is readable > var_dump(new ReflectionProperty($c, 'foo')->isReadable(null, $c)); > ``` > > One could skip the `__isset()` check in order to avoid the=20 > false-negative, at the cost of more false-positives. I don=E2=80=99t k= now what=20 > is best, because I tend to avoid `__get()` like the plague anyway. As discussed earlier in the thread and noted in the RFC, as long as hook= s and __get support arbitrary code, we can never guarantee no false posi= tives or negatives. Based on the earlier discussion, the current setup = seems like the best balance for the expected typical cases. So we'd rat= her stick with how it is now. --Larry Garfield