Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127377 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 BBCED1A00BC for ; Thu, 15 May 2025 13:53:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1747317098; bh=e8ylFAZPjdKmNvBN9f/JwZXvY92V2hFFCtc/47NClv4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ihkdeQFgMt999NhTDHRMIFfen6UHbTSxklL3IhB9ZBTJ+k8+kExsdIMRfjWH/cu99 XX33LvetcqAHn71S+78rNna8fZ7HxcgG/0UKs/hlvFtJs8FoWumnHK1EjJ6IiuztZx 44DpRJEfBeNCqEf+epfbfGYJ+5qS4SIn05IcIPEZuGNpV9WpTDGy2gmWRrOCqLfVxb ak6MbX3RDhmbHaMbBDxVYxZo/puSkRjVNIgTpnGod2D2kZu35Kz5oT8RcnFsk7OkUb B1p8KdTdQTg/4apsWWLEIdCKOjhJacCbYqz/OML0MiDiCLKF5jX/SL6cCvGJ2enaq0 HjlkKmTD5jDdA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E4EE518004D for ; Thu, 15 May 2025 13:51:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (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, 15 May 2025 13:51:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1747317226; bh=E61S9sTExjTZVvnU/e/A4IBvB0bpyMdGRN3AVsZ3Zy4=; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:Content-Type:from:to:cc:subject:message-id; b=Cz9IsctDBImJ9D7YJJpXTjFPoSdnUDyiuJhp157IzgAzCtWPW6q65cJE6+TR2lFGJ 892pMBS9F4V9TxosWopdZS7Qg1tGJWi1IHoRuMKvj3JNzd5cD1DiI2iaLMg4T68R9p 7Cx0MjcpU//+xfROj6Ly/LmxABs6VNvkbRLaKGEa+dYLkh9XDlzVAeidCHoFxrUtsb xuYcPPWnf0vw0bSrs289m9gMnmmz9qeJqaDcTkmKLZkruBPZBbadVZbLpdl5k8D+ME 0+GC4gNN6SY5wQzbbN+6OVhnKXH7kRAvNkkWs8jzhA8IL9WHiF2YSucMhJRjm+N3ZQ jiHzP8x96zw5g== Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Thu, 15 May 2025 15:53:46 +0200 To: Larry Garfield Cc: php internals Subject: Re: [PHP-DEV] [RFC] Clone with v2 In-Reply-To: References: <4a703db4174763586d84b9bf5606ff31@bastelstu.be> Message-ID: <956887e5b66e2b43459b999ebac2069d@bastelstu.be> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=C3=BCsterhus?=) Hi Am 2025-05-15 00:04, schrieb Larry Garfield: > Subtle point here. If the __clone() method touches a readonly > property, does that make the property inaccessible to the new > clone-with? Yes. Quoting from the RFC: > The currently linked implementation “locks” a property if it modified > within __clone(), if this is useful is up for debate. - > A single unlock block would be confusing to me. We’ve implemented it like that, because it felt most in line with what was decided in https://wiki.php.net/rfc/readonly_amendments#proposal_2readonly_properties_can_be_reinitialized_during_cloning, which says: > Reinitialization of each property is possible once and only once: We expect “public(set) readonly” + “__clone()” to be rare and from within the class, the author knows how their `__clone()` implementation works and can make sure it is compatible with whatever properties they might want to update during cloning. The lack of “use cases” is the primary reason we made the more conservative choice, but we are not particularly attached to this specific behavior. Best regards Tim Düsterhus