Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129756 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 6CB471A00BC for ; Wed, 14 Jan 2026 20:00:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1768420846; bh=JRkCCC4JB2HIINJGIoytWVrSt97oJLU92IiCfqrdIHo=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=dXWhzw2rOUpQfnBtgfcym8eP+MzeqZjDNYHtFdYJknceK7Hc0lCwCm7OZ6X4bYiZT KRUMtaPpiGqCJ+gJHgpRatu4ktKMc1hM8ntW2rKZwyd80gNfWLRgBxWXbj0uOqQUU1 TaWDf6kI4Trhj3oBRHGsHfl1CTtp668w0Dmbj33j3to7/KfLyj2WxUr4+nHMni5rLk n2guD19ABZiRrWkhe3dqUuzUKIhBk3P9aiwnHq8B1V4tXzRORMtUqrBNSQljysk2Rd wS0PBw37LOfChszQBYraykZa8t6czFGvw/nyqkevSbHsLvDqkfsdm3J1lnaQ+4EkBn 0hZPONiAzSMxw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0E51A180086 for ; Wed, 14 Jan 2026 20:00:42 +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.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, T_SPF_TEMPERROR autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (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 ; Wed, 14 Jan 2026 20:00:38 +0000 (UTC) Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-47ee4539adfso1998385e9.3 for ; Wed, 14 Jan 2026 12:00:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768420833; x=1769025633; darn=lists.php.net; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=LVU5U9c8KwCQvZsSn2Qkh1egSbaamzs/SUDwywY+oSw=; b=ju92vel4BIsoiXSFUGZALDxxnLTtM+E332NbhKacwP0CmOzUgRBljNWzPq8hSxDUS4 vM1dWBLS3T72+GnMUn8Wt5KbxEWl9rOJx0jurFv3y7cr60IPefgAsZr0kRRAmQg/nEdi LOI24dnwmWL0J5CY1mOBt66uIWQFHr1gJI5mNV55x9X/fWZa+wQqUSSKf0gO7kUULu3g W4JsUCiqmdMQ5RsYaDLwEt4ekqnJPYwUw0O3UQJ9Eun4VXPSQSsev3aOTBNxFoDyPCqj 144z0I3JYfaA7wpsC0ylXd/0ubCDnUUXW2ZDQoy08qNqW6rqT5AquW+Wz50SkZrgCoh1 8r7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768420833; x=1769025633; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=LVU5U9c8KwCQvZsSn2Qkh1egSbaamzs/SUDwywY+oSw=; b=iEM5irgzy83xX4DJGk6aot+KpZKYQDC3pbDsMVXX/sBMyhKj+OrK8lMI1mW6jDr/Oq wcprSYOF4MpPPbg3TITdMEL+4Fzy7dynlgv5WvJJKkZq4SZ/GBUH9SLdTppf2gC5Sa7K L73ILjuoQm15s6ZYRZ91YLIJrebr8h0XaBzGyWYyrrWZBO6ZHRrL8pnkXG04QS4EB8bU mjS5Yzkl7ByzLOEi6UobmVPV/xe7RmTeJuxPQJRwJ0oMbD+2pwH0RVG7NwtsupTu/4OS KGqlRg8mE3OLqBuTOc70gQAVnvUiAtg3uply/EfI7EP+IwuBRf4M4af9Hn+rda5TdZsn OGHA== X-Gm-Message-State: AOJu0YwAGHSaae+EXmcNX5bWc3xB7mNHTtssTjH+meWICDaYGXHikHLR IaQJ9Nm7oMwwNLHyGYQd1Os1vdLVqKRaV362ycKSEITSXjlM4lie9/BuFPZkQw== X-Gm-Gg: AY/fxX60CnpoVNbfCrHMgKscuyXKtPVzBbf+UMKRWPB7qXuwymm64VFSZkKywEN5jEe 9Oy4UVScztFWoaNqBrT1II81ofImN46P9wcj6G1+A5HlqThRkrxW9s1qCjiRRHrToQd/gIct3Y7 TgSZShA9thQUbVS45annxejJjEoejQzq/5GnvDR8brHCf8rOE1QYSEmuKb6R6WxG3miA5Q6eQOY KniF64woJ3LEwrhQL+YHF2MbuX8I/rZCn/KdT74z9xSFj1YJpYdwMv9azv8Xo/SoP6YBH42/xBx l0ljjKnUSx/4YIGDniSJmmOqZ3MDUNejCxClaqICs34tt4s0WomYLa0fMW/U2RnzJmlJ8ecAnfT 7Nl8quEeDk44HMvogvwGxkcOL0t+XCmAXsZx3+icI1TkK5CFR5WEpMjzYomwfdu3q+73fY71QH/ HBQ3aWX07mVBuP3ER0GxEFCVvNXfmUgJzjEQ== X-Received: by 2002:a05:600c:3e8d:b0:475:e067:f23d with SMTP id 5b1f17b1804b1-47ee338a3f4mr48104155e9.25.1768420832386; Wed, 14 Jan 2026 12:00:32 -0800 (PST) Received: from smtpclient.apple ([89.249.45.14]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47f428ac749sm7605545e9.5.2026.01.14.12.00.31 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Jan 2026 12:00:31 -0800 (PST) Message-ID: <352B0914-68EE-480B-895F-D7CB767A15B3@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_E966A792-3DA0-4F48-B2FF-3A0E1244EE56" Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.300.41.1.7\)) Subject: Re: [PHP-DEV] [RFC] isReadable/isWriteable property reflection Date: Wed, 14 Jan 2026 21:00:21 +0100 In-Reply-To: Cc: php internals To: Larry Garfield References: X-Mailer: Apple Mail (2.3864.300.41.1.7) From: claude.pache@gmail.com (Claude Pache) --Apple-Mail=_E966A792-3DA0-4F48-B2FF-3A0E1244EE56 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > 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 = constructive feedback. >=20 > --Larry Garfield Hi, The RFC says:=20 > To use =E2=80=9Cmy current scope,=E2=80=9D the static::class construct = is an easy way to specify =E2=80=9Cwhatever class this code is running = in.=E2=80=9D The code is running in `self::class` or `__CLASS__`, not in = `static::class`. ------ As noted in the RFC, `isReadable()` will give unavoidable = false-positives (returning `true` although attempt to read the property = 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 = `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 = false-negative, at the cost of more false-positives. I don=E2=80=99t = know what is best, because I tend to avoid `__get()` like the plague = anyway. =E2=80=94Claude --Apple-Mail=_E966A792-3DA0-4F48-B2FF-3A0E1244EE56 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

Le 13 janv. 2026 =C3=A0 22:30, Larry Garfield = <larry@garfieldtech.com> a =C3=A9crit :

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
adding = isReadable/isWriteable methods to ReflectionProperty.  Took a =
while, but here we are.  A strangely small RFC from = us:

https://wiki.php.net/rfc/isreadable-iswriteable

Hi folks.

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.

I'll call the vote later this = week, baring any new serious constructive feedback.

--Larry = Garfield

Hi,

The RFC says: 

To use =E2=80=9Cmy current scope,=E2=80=9D the static::class construct is an easy way to = specify =E2=80=9Cwhatever class this code is running = in.=E2=80=9D

The code is running in `self::class` or = `__CLASS__`, not in = `static::class`.

------

= As noted in the RFC, `isReadable()` will give unavoidable = false-positives (returning `true` although attempt to read the property = will error). But there is also a = false-negative:

```php
class C = {

    function = __construct(
        readonly private = mixed $foo
    ) { }
  =   
    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 `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 false-negative, at the cost of = more false-positives. I don=E2=80=99t know what is best, because I tend = to avoid `__get()` like the plague = anyway.


=E2=80=94Claude
=
= --Apple-Mail=_E966A792-3DA0-4F48-B2FF-3A0E1244EE56--