Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127369 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 A448E1A00BC for ; Thu, 15 May 2025 06:23:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1747290070; bh=OalC6mgKNiItkNL/2VdezLcB9J+trlr8AeFyrYzIxj0=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=KLwPZNMGgxvObUi2+Z7TS6xL0rW8v17J/NOPZ6LDGOROecYOrG+Qdcl8DT5BAEgH6 lR3oV/57klsnpZVL79VNPEl5xhZlzfyw3fIs3f7IFCOP5J4a0X+t26iKAo1Pw9QdBK yINXhVhMTI+Dj/EjpDXz4WoHpY8/0w36rINPRGsIyEEd/hZSqjuh3FPSOtxSZTei+l g8HBXpwASEcEhBbw9cRdb5GO2ITw4aKS+zRSmW1t/0vyiG1YxZvulho9Pf1NwtYPJZ DMB/y8HjPaiTTzgTXeKU7wvtsyzC/sEVm3Gmc7ChbcpRMXMhiYCyygSnmWYcCCEUz1 c79/oh0QSvPlg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 716D1180051 for ; Thu, 15 May 2025 06:21:09 +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.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,HTML_MESSAGE, SPF_HELO_PASS,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 mail1.25mail.st (mail1.25mail.st [206.123.115.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 15 May 2025 06:20:58 +0000 (UTC) Received: from smtpclient.apple (unknown [49.48.223.253]) by mail1.25mail.st (Postfix) with ESMTPSA id 5B83E60402; Thu, 15 May 2025 06:22:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=koalephant.com; s=25mailst; t=1747290187; bh=OalC6mgKNiItkNL/2VdezLcB9J+trlr8AeFyrYzIxj0=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=CzITIdqEiKO1MnvXUUYppt57qhMY4Lgtzium+qpD2pn1HA+K03dRf3A+zUPzQAXSB llemrdTlAmnKLroHrRhClanNQAmOZHrnfqpKLVkqqdwBujzSV+ZLjzeTZnKwllKpjV a8vNeAt+Y+94ogi3RlUuGAPB1aOMaNig9s0V29RMDZurkEUfkg+kU33dDT3aJRxYU6 BJGjKFPgZRg+5wfUaUNHSWrMCYGON1gHafTAT6YITw6BbDCFW2ario0jX3Vaoys4Aw sGPvPq25P111o/vLOEjLD4mBA+bslS87snDJUfxIHVLrEW9kv4xqH2IwOdGqZLh0nU M/RxciZkSFBIg== Message-ID: Content-Type: multipart/alternative; boundary="Apple-Mail=_18462730-38B2-44C6-9471-6E711B7E85CB" Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.600.51.1.1\)) Subject: Re: [PHP-DEV] [RFC] Clone with v2 Date: Thu, 15 May 2025 13:22:45 +0700 In-Reply-To: Cc: Matthew Weier O'Phinney , php internals , =?utf-8?Q?Tim_D=C3=BCsterhus?= To: Volker Dusch References: X-Mailer: Apple Mail (2.3826.600.51.1.1) From: php-lists@koalephant.com (Stephen Reay) --Apple-Mail=_18462730-38B2-44C6-9471-6E711B7E85CB Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On 15 May 2025, at 06:26, Volker Dusch = wrote: >=20 > On Wed, May 14, 2025 at 10:06=E2=80=AFPM Matthew Weier O'Phinney = > wrote: >=20 > > The only question that arose for me is: what happens if a property = name is provided to `clone()` that does not exist in the class = definition; what will be the behavior at that time? Will an exception or = error be thrown? If so, will it be a new one, or an existing one?=20 >=20 > Thank you for the question. I had that one myself looking at the = initial implementation and forgot to write that down more explicitly.=20 >=20 > Tim already answered and linked the test, but I've also added an = example to the RFC. >=20 > -- > Volker Dusch > Head of Engineering > Tideways GmbH > K=C3=B6nigswinterer Str. 116 > 53227 Bonn > https://tideways.io/imprint >=20 > Sitz der Gesellschaft: Bonn > Gesch=C3=A4ftsf=C3=BChrer: Benjamin Au=C3=9Fenhofer (geb. Eberlei) > Registergericht: Amtsgericht Bonn, HRB 22127 I may be missing something here..=20 So far the issues are "how do we deal with a parameter for the actual = object, vs new properties to apply", "should __clone be called before = or after the changes" and "this won't allow regular readonly properties = to be modified". Isn't the previous suggestion of passing the new property arguments = directly to the __clone method the obvious solution to all three = problems?=20 There's no potential for a conflicting property name, the developer can = use the new property values in the order they see fit relative to the = logic in the __clone call, and it's inherently in scope to write to any = (unlocked during __clone) readonly properties. Cheers Stephen=20 --Apple-Mail=_18462730-38B2-44C6-9471-6E711B7E85CB Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
On 15 May = 2025, at 06:26, Volker Dusch <volker@tideways-gmbh.com> = wrote:

On Wed, May 14, 2025 at 10:06=E2=80=AFPM = Matthew Weier O'Phinney <mweierophinney@gmail.com> = wrote:

> The only = question that arose for me is: what happens if a property name is = provided to `clone()` that does not exist in the class definition; what = will be the behavior at that time? Will an exception or error be thrown? = If so, will it be a new one, or an existing one? 

Thank you for the question. I had that one = myself looking at the initial implementation and forgot to write = that down more explicitly. 

Tim already = answered and linked the test, but I've also added an example to the = RFC.

-- =
Volker Dusch
Head of Engineering
Tideways GmbH
K=C3=B6nigswinterer Str. = 116
53227 Bonn

=
Sitz der Gesellschaft: Bonn
Gesch=C3=A4ftsf=C3=BChrer: = Benjamin Au=C3=9Fenhofer (geb. Eberlei)
Registergericht: = Amtsgericht Bonn, HRB 22127

I may be missing something = here.. 

So far the issues are "how do we = deal with a parameter for the actual object, vs new properties to = apply",  "should __clone be called before or after the changes" and = "this won't allow regular readonly properties to be = modified".

Isn't the previous suggestion of = passing the new property arguments directly to the __clone method the = obvious solution to all three = problems? 

There's no potential for a = conflicting property name, the developer can use the new property values = in the order they see fit relative to the logic in the __clone call, and = it's inherently in scope to write to any (unlocked during __clone) = readonly = properties.



Cheers<= /div>

Stephen 


=

= --Apple-Mail=_18462730-38B2-44C6-9471-6E711B7E85CB--