Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129598 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 B6BD51A00BC for ; Fri, 12 Dec 2025 21:47:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1765576055; bh=H8u0/biNrNpt19Uz64T57cD0vYaXlbFdsrEvwmVG4EQ=; h=Date:From:To:In-Reply-To:References:Subject:From; b=EgaqrTkQo4xv297Xb/2ZIdOcF6gmiRNS7nNWZCKj7xCTYOtmQocB+WBEkHJLMOnMH 0wYaSAeGWXjWthEs8RWgaED7PhFSuLouhjl3GMX5+Cxs1a56eYvfKqakNQ3AsRete+ vOxiinE1Gp7ALQ5j6CoACzzhy3pAFqpg2LmE8aqAsA+gAaEGy5P2fcZbi7DGrSGdtK RBAL3aahrSSwydBUiOnB8RU2w7+1TuOYx20RPe49lG3UBR/D7WQWy4EchkOH3iAtPg 5C6TpX8iyw9YY/r3TtHlIe58Rj6fzJlA4XGwoyyxp89s0Ww0pOWYUi3wmY0zSmd7mK YOf3HqU7iHsyg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6BCBA180050 for ; Fri, 12 Dec 2025 21:47:34 +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, 12 Dec 2025 21:47:34 +0000 (UTC) Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.phl.internal (Postfix) with ESMTP id A62E3EC0622 for ; Fri, 12 Dec 2025 16:47:28 -0500 (EST) Received: from phl-imap-01 ([10.202.2.91]) by phl-compute-04.internal (MEProxy); Fri, 12 Dec 2025 16:47:28 -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=1765576048; x=1765662448; bh=lP2HHS8Zgx2yVK6O4fWYx rRgXbsdfN3wblezZiCTsdk=; b=or+hXjdefNuUrE7Q0lDBR3OKqhXvaciSQIGEY zLfrmsYF9xG/3l4L6AU3dAEKBLLXmkUGLEObKuGeiovklLYVTPSaq8ccrhq65XWc FIeduUEuBi0kvdRmWri3Q6iyJoVq9Ln8yO6mCWZupG6aJvxhdna/TtWrq/2HOES6 TXMVA/ODrPZs5Pyud8aV/7PC+cLdMXDWNtJ98pWasi1FkN7bOojeATVLb9MBm1jj 2UKrHFdQ28ivJ8hv9zRojZEleKk9qUII1lOSfP1RRIlrpew6SLzpbaW+gCHl6h3z O0S6Z4lnVQiVhWrKAMnLIYT00sh7IpDPg4SzVoFg4Sed9pbQQ== 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=1765576048; x=1765662448; bh=l P2HHS8Zgx2yVK6O4fWYxrRgXbsdfN3wblezZiCTsdk=; b=S9PzUThTa/ZgMBI6q 9+gpZezqgRjySSYprLcIkfiP01VeFHfu2VLO5EpPj5adKnCaHbFyIhyalu2pME0k tgb1uWdpkN35Vo0VuqKslhih9p00n06EOJHwCuvoqKYaTRWdwH5h/Ej8jkil5JBQ HE/2RO6PJUwDOiado0EeVbm7vXbqPK0+7c+8fiiSirfaMBHk1lQZbo8p3OZER208 58nT+sMIK1PE32tIDagafXufuNpBC/b+qWzDmLmIzPjGLQC1hlFFmV8DTQoVj9r9 Xm85uvHSelytBCthgyin6l7re7LwwkgtM9CSFwGvlIYhVFqivCTN2g6m6orUVnyE mcU5A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvledvlecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefoggffhffvkfgjfhfutgfgsehtjeertdertddtnecuhfhrohhmpedfnfgrrhhrhicu ifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomheqne cuggftrfgrthhtvghrnhepueevvdduhffffffhleeuhedvjeevgfelgeetgefftedufeel heegfedvheegleetnecuffhomhgrihhnpehphhhprdhnvghtnecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomheplhgrrhhrhiesghgrrhhfihgvlhgu thgvtghhrdgtohhmpdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdprh gtphhtthhopehinhhtvghrnhgrlhhssehlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 38D9018C004E; Fri, 12 Dec 2025 16:47:28 -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, 12 Dec 2025 15:47:07 -0600 To: "php internals" Message-ID: In-Reply-To: References: Subject: Re: [PHP-DEV] [RFC] isReadable/isWriteable property reflection Content-Type: text/plain Content-Transfer-Encoding: 7bit From: larry@garfieldtech.com ("Larry Garfield") On Thu, Dec 4, 2025, at 2:54 PM, Bob Weinand wrote: > Hey Larry, > > On 6.11.2025 00:24:52, 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 > > > Have you considered returning false on isReadable() and isWritable() for > methods, whose only statement is throwing? I.e. when a getter or setter > unconditionally throws without any other statements present, they are > not marked as readable or writable. > > Otherwise this essentially "punishes" providing better exceptions in a > getter or setter, and serves also cases where the LSP inheritance forces > presence of a getter/setter, but still shall not be allowed on the > specific instance. > > > Thanks, > Bob Hi Bob. We've discussed it privately, and feel it would be an unprecedented amount of magic behavior to introduce in what is otherwise a fairly small utility RFC. Nowhere else does PHP do that kind of deep runtime introspection, and it's a rabbit hole much larger than we want to tackle. It's also a non-trivial problem to solve. For `throw new Exception();`, the opcodes look something like `V1 = NEW; DO_FCALL; THROW V1;.` That's fairly straight-forward. But what about: * throw new Exception(getErrorMessage()); * throw new Exception(cond() ? 'Message 1' : 'Message 2'); * $message = getErrorMessage(); throw new Exception($message); * if (cond()) { $message = 'Message 1'; } else { $message = 'Message 2'; } throw new Exception($message); It's very hard to draw an arbitrary line to decide what is and what isn't allowed. Handling these cases correctly would require a significant amount of complexity, and would still be incomplete. If making small, seemingly benign changes can break the exception detection, that's arguably worse than no detection at all. For now we'd rather just avoid that rabbit hole. --Larry Garfield