Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119066 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 56487 invoked from network); 30 Nov 2022 19:40:23 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 30 Nov 2022 19:40:23 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9462A1804F8 for ; Wed, 30 Nov 2022 11:40:23 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-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,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS29838 64.147.123.0/24 X-Spam-Virus: No X-Envelope-From: Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 30 Nov 2022 11:40:23 -0800 (PST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 6C6A73200985 for ; Wed, 30 Nov 2022 14:40:22 -0500 (EST) Received: from imap50 ([10.202.2.100]) by compute4.internal (MEProxy); Wed, 30 Nov 2022 14:40:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1669837221; x= 1669923621; bh=d/f/Dd53UCnozIRMhxx4sry4w3rTRdVDnaGWCYt1MSw=; b=Z c7/BnTPptLLQeKDrL9QzoURW/V0EvtozMsqP/L/g7MtOKhceQIMj7MYLvExf+2fp f4PuDTfzAzUvmHsWi0j9oSG4qgUsk5109lv1aiXtBLSF+jbd1l8a9JS9zAI4sd3O QSTzN2hgFqnpGI9EkuLZvMi0gp8iP0fKjfI+SaH7d7D033SsfMOLsTI0jGol+APm a3gwzAn4tqFFeOtOUF4z7IRZnWLeyVKLh5tbS1j+iqP6zvBa6sDWsSXD+dB4woOb 6M7tQRHGPA78wKONnGoIWo05+pmsexrTv1hnl1PFxovjKKAT+vFTojV8/chHz4U0 Cj92yP2eLZyDGagiX4RRg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1669837221; x=1669923621; bh=d/f/Dd53UCnozIRMhxx4sry4w3rT RdVDnaGWCYt1MSw=; b=swr86+IggvwbMauaHXLWoHj1I2dnjssReQK7omjQJbP/ 3hJaPj8UBQs3FoavzWU+IgjNYktzzA3OlPsf8j3HELkiO+MwnW2C70HqcGoIa+2I GloxRy+Glzn/+Mv1a9GnbXfp4R6QKSmAizgC5y3yU7ujJUwVBOSOX2w240JShKvM wZecIk5owkAyz8upr6EvTY43k8+uG/7giflsgiLOVAaHNB/CqhDc4N1VjWwWe0MD DileYEEES7OTqHcHdgqVux0+J8ybBmn421+v8pCIABGDOeeeydTi4IxtchU2X8JC M8jLA1J3t1g9gZOJWvoJVkDpiN9jmipUGYM7S0ex9g== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrtdefgdduvdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesthdtredtreertdenucfhrhhomhepfdfnrghr rhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtoh hmqeenucggtffrrghtthgvrhhnpeeglefgkeduiedvvdetffeujefftdfhjeeiveehgfff keduveektddvledvvdfffeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmh grihhlfhhrohhmpehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomh X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id B3B9F1700089; Wed, 30 Nov 2022 14:40:21 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.7.0-alpha0-1115-g8b801eadce-fm-20221102.001-g8b801ead Mime-Version: 1.0 Message-ID: <71720d8d-b73e-4542-bca1-6571f2ce0a34@app.fastmail.com> In-Reply-To: <4CEC2995-9485-4884-845B-54B419DFC269@gmail.com> References: <0854b030-c51c-4c1b-a7dd-22835a1e5da9@app.fastmail.com> <831b9906-dc0c-420c-b22f-8a0cc8a1ad64@app.fastmail.com> <4CEC2995-9485-4884-845B-54B419DFC269@gmail.com> Date: Wed, 30 Nov 2022 13:40:00 -0600 To: "php internals" Content-Type: text/plain Subject: Re: [PHP-DEV] [RFC] Asymmetric Visibility, with readonly From: larry@garfieldtech.com ("Larry Garfield") On Wed, Nov 30, 2022, at 12:10 PM, Claude Pache wrote: > Hi, > > What is the behaviour of the following code? > > ```php > class Foo { > public private(set) array $bar = [ ]; > } > > $foo = new Foo; > > $foo->bar['x'] = 'y'; // error? > > var_dump(isset($foo->bar['x'])); // true?, false? > ``` > > I think that modification of an array should require write access? > (That should be clarified in the RFC.) Correct, that would not be allowed. Array writes are always indirect modification, because it's two steps to get to it. That will error out in this case, as one would expect from `private(set)`. --Larry Garfield