Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127372 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 6F5AA1A00BC for ; Thu, 15 May 2025 09:32:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1747301406; bh=wujhkbOwKDsPJuk3m1QKQvIoJL5AZSZm1VnoetGA7es=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=UBSDc5CuEUZw5kmZ2npZRhUd4ml8BpTc7BpO48ktGnH+RHZqBJMYFGIr9y4b/3Dku GPeXlY9HfjC9bnxYb60cgAxDoEKWOd7L8wwWFoucPNoSZm4LWCGfqDjsbehnknhEuh AN1l0JwOxkGiDpAY06fp7JXEoNdBi6F8WlNT7cNLMlRgWDOZkBPF64j2GjI8dMUUPk kFOHKuSHEBAtFK/mhLgm8pW6gBgISYkpsIus46OUaAk76wg3uKIq6+Y3mYZaDQZjUb s5RPaJjmVZBLFcLUm+28X5aSoE7eihSgflj5v1o7KyTFUK5+8zv/CfBGFPYJYa1csH yyRo7q+IBBPIA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9BBDF18006C for ; Thu, 15 May 2025 09:30:05 +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,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,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 mail-yb1-f172.google.com (mail-yb1-f172.google.com [209.85.219.172]) (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 09:30:05 +0000 (UTC) Received: by mail-yb1-f172.google.com with SMTP id 3f1490d57ef6-e78effa4b34so1656547276.0 for ; Thu, 15 May 2025 02:32:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dqxtech.net; s=google; t=1747301535; x=1747906335; darn=lists.php.net; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=c6Q2LwpYUrupJX/LiIb0Uz28HS22YEAtfh3bJkrWVkk=; b=Z3jfRESW/OMwempP6XEyvet474mJbTDjFULoR7mKUjJW7SB1dhcFyW9t2vJzvWMxMb RAJP9miAba1qEC4b+jru4362IjUP+suxahjfNYpZdWX7lHHIHLsjmfahRDhr0PikL4/M eaasjhham/w6PtVkQ7j8GNj8vOHTeWM/q+IjC1BfACw8SzOuqWzjIAltZ1NxAeQySYB8 jotZNWq5IRtGq6p7DKQkOcgC2fFxsFXWpiMKCqUXcvEVHZTtTKl7i+XQ8a6gc7M/Bx4A Jk5APoMe/ZwoIcK91YrbriMoa5NkY2SyVpwJ9qrXDEnZbY453D44xBRQ40ryQ8/IWWvQ 7kkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747301535; x=1747906335; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=c6Q2LwpYUrupJX/LiIb0Uz28HS22YEAtfh3bJkrWVkk=; b=kR+2VeKQbrPtuiSrymLGlJJgkRzAjFxxTquSKHmmcVlekiu0VaqboooCtOZHNbZc5k QWPUNiSak1XZX9EsZGqS7A0AIAp39qua6ynTvuByF2e2/myGUo0xxKJrtyU3/O/V38nA b4L2/21rpvrfQAo2/ppDlO7t79Rh1ITYMiegi7rN0TIrMSo2fDeuSSAoZakmHuIJ3ZlN 3u2jwtSV7yN1wl63AY/+a1GHqKKesGtitLpw2yOOy7H8WxlCV4e/ovehOd296VORtOn7 zXGnR7Lg/m25ZUHcBnaU3VLC09L9caQjlMnR5Tfsl5DrAu7fKNoDoD93ixJoNYuEvPAJ M7qw== X-Forwarded-Encrypted: i=1; AJvYcCVqqkCKZF95oA9LgNd1ULbAyYN27o/ps1CFxPiXtZOJMdgtYOX5dX1TAiDOqnTM1l0+CPf+sc8+oNI=@lists.php.net X-Gm-Message-State: AOJu0YzD8fVF8UyXjnwhZqnmGJ8iaTdVLqxK6E29rPVkz7P7zvY4fK6A lSn29I/DDfBvuvSXvEVB3vlfIhgaEDyXmk5yecdX6plYIZeJ4/KAOKbyUf+Cn9PdR9ddS1EoQPe Mx3mhITluSTaTMOKOuL5GlfNSpmOD73M8+5WnNCtCmQ== X-Gm-Gg: ASbGncvtQqylF/bohUxmgrIdEGU6JwJLYYlt0oF3kuNmlfnizQoyQe/Pd60vilkcOva 1VFqxTYkmG5XwVnnlO3JcYX2n6CfSaIoJEVYQkdl2QuM0gN90ZPi1aCAEGKzO3yczNafYFs0poU zWZKoFbYJTFAt4tSwbPdQTjDkm6XH2BPcVqMsPJYC8TEdDN0QkDWueONZLZr9xIukH/tg= X-Google-Smtp-Source: AGHT+IHPFvyVlT5SCBEBCLwB7XKXvCBUJTjgejTbn/xVklz/o/ZdhJjj0AVLBkVbAcA1RpSozesTWgbQutv05nHbsE4= X-Received: by 2002:a05:6902:4302:b0:e7b:51e0:37af with SMTP id 3f1490d57ef6-e7b51e037f0mr2349443276.10.1747301535366; Thu, 15 May 2025 02:32:15 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 15 May 2025 11:32:04 +0200 X-Gm-Features: AX0GCFsB4w3c_ZoLu9ppwHvYcwkZHYr_jZCZ2TJEcJiiq5TOSpWDfoJfOcBuv8s Message-ID: Subject: Re: [PHP-DEV] [RFC] Clone with v2 To: Stephen Reay Cc: Volker Dusch , "Matthew Weier O'Phinney" , php internals , =?UTF-8?Q?Tim_D=C3=BCsterhus?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: andreas@dqxtech.net (Andreas Hennings) On Thu, 15 May 2025 at 08:24, Stephen Reay wrote= : [..] > > > I may be missing something here.. > > So far the issues are "how do we deal with a parameter for the actual obj= ect, vs new properties to apply", "should __clone be called before or afte= r the changes" and "this won't allow regular readonly properties to be modi= fied". > > Isn't the previous suggestion of passing the new property arguments direc= tly to the __clone method the obvious solution to all three problems? What exactly should happen then? Would the __clone() method be responsible for assigning those properties? Or does the __clone() method get the chance to alter the values before they are assigned? (this would mean they have to be passed by reference) I think this last option is the best, because the values in the array can be changed without any readonly constraints. Another option I was thinking of would be to call __clone() after the changes are applied, and pass both the original object and the array of changes as first parameter. But I think this is a dead end. -- Andreas > > There's no potential for a conflicting property name, the developer can u= se 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 > > >