Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128971 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 E99D81A00BC for ; Sun, 26 Oct 2025 17:50:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1761501026; bh=s99UqOEif1dk8ztu+cv11ZQ0uxQinE7gW6/jurWKjWs=; h=References:In-Reply-To:From:Date:Subject:To:From; b=bieVNAK30GTDU70q2MOzTmFX8e4EWPmHwNIPOdnFV4BU9P1w30D9St/VAFygRhTe2 adklFAGZMehWTk+hye4sU8PpzcFI8NR53yhWscGej0jkeAzWSLadH8JWFXSyjbz7/2 wcbEwakN8hAJp7BY6ty7SUsjvI0IrY9gbFM4X24kAhJywkyUHMYfIMOx9VcjwghqtV stv20sIK2FX06wyV8UnhrxvchFsX5Wt/RkLOijcXGsMzRZes0ZvsDRfRhw1Zusr5Yc FwJloyoSh50J03PVSSCUaOlMxtZHyf9Q/agyLCEDiSj+UVqD5o75onj5a2YmLj+rE9 NfztaNQj5eejg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 91933180056 for ; Sun, 26 Oct 2025 17:50:25 +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.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,HTML_MESSAGE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-yx1-f53.google.com (mail-yx1-f53.google.com [74.125.224.53]) (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 ; Sun, 26 Oct 2025 17:50:25 +0000 (UTC) Received: by mail-yx1-f53.google.com with SMTP id 956f58d0204a3-63e19642764so3980095d50.1 for ; Sun, 26 Oct 2025 10:50:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intuitivetechnology.com; s=google; t=1761501019; x=1762105819; darn=lists.php.net; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=5wBq8dzuCvHOhMm3jtbZrcNDfggI1/vRfL3tkePaLWU=; b=i1K21eYP3gJA2WqGt+gFAX/EJvyCfI7XEPHxhB6BXE5TIlIAg77Zg4gbMedSR3v3Ik HYnpB5swE9tmz88yIvMRwPIpHFwSig6HAgcH4OQTnsC1OmwKHQVrVE9u21g5Hc5nbd+v u+Z8HXB8YVpc/W677rNwJ/Dh2N5o/4gcchAvPpWyPAjYt2kW3wadjHhvVkdj0u01OKig m4JmlUzoDGCAyX6A36CQujgbgIA/3ZgYJDgMZ0G+QjahXUvdDTeHCl9mpew8cZto3ZgQ BP4Ly3MpDzMcpCiGzYML0pATWrW1RwY89z+XtVNxu3n5MfGefvgfJND07YuJQGsGXLV8 NgKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761501019; x=1762105819; h=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=5wBq8dzuCvHOhMm3jtbZrcNDfggI1/vRfL3tkePaLWU=; b=KLg2Rwck1G7C1Uq/5EScTfd7vQ4h9dlm+puZUsebe9OPqeGWt+8LiME20mZ++wJL7z dyx1TwDH2hXHONAo8Oma18hBfwlRuWSRGCVRSbUiThoQGlJuhOM8ytFb9bBIh3WZSwUT 4rmh/7MxM8K5nzNxX0P5rx2iJu6uKqLTtwH0mainxw+XA9HIvtS7MvwLtR2uER/jIX+k owNVjajfCig+QfAB8obtjsBzohW0do+lFbSy9CnN7L35HOJUgsR/Xjpg0KvO2lHgF3fs Sw2ZIYBfKO6ibGB3J3WljHMVZPe2weCLXIiHF5il1xzzEBwz8UfVWpSJbEdRF2KaaKz2 gtyA== X-Gm-Message-State: AOJu0YxdSIcsUiqyhKwH69NismM024Hi1I7m4iqULtPKWg4UiEPCh8Fc oFeFlV4OyQVNQzts2QnR7EqDsCn9kHCVPlfQiNMd/33d2IuzSwdNQOfF5VS+XTqPnCEFddLSORk 8fhVFWrasT6r/Q3ocLRw4WZPuJjPDj3UChXWmpQykslcZyt1Bx6mG23Q= X-Gm-Gg: ASbGncsqBOjD3gSvSw/hKlCtzYAwFIuDnjq/kgV4qHEQPAqtEPGaNv0FEQjlRZ0USyf j2oANGkl199UsJyMz+TqnVuEuIRBZOqng2rhJSsjEXVC40OGeXPy/V9fxzjhhbiXVGfEI35y2QZ 6lfkKgl1fN8Sba93U2v9O3XIjNwPCGPILNfkuvReu3ELOYMTQPoTaLn39eaoTWPqU0SkpkPN+aB PfdwmGY4TP6qp7ReUBwsjiRDNU7tdHhpMP/H5UQVorz1knGS5wwAH4zqV8znWPpDVApeD0Cfl50 8x2fwY8= X-Google-Smtp-Source: AGHT+IH2O+hFSUqcJoYXWOblCpHKmPN3mjPjp/EBxUGljfvfXRWNVd5kTSIxOX3e+pYjRjIafAA2CbQz7oS5oa2Hl18= X-Received: by 2002:a05:690e:1483:b0:63e:287c:70cd with SMTP id 956f58d0204a3-63e287c72bamr23980145d50.34.1761501019333; Sun, 26 Oct 2025 10:50:19 -0700 (PDT) Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: <48b2d4f5-2baa-4dac-9f13-163ac68a4adf@app.fastmail.com> In-Reply-To: Date: Sun, 26 Oct 2025 10:50:07 -0700 X-Gm-Features: AWmQ_bntUpIKoyREhA0pmov1btdPFNDlz0Eiv3I8ckcEbUIaSA9bjNSqTbe_YZA Message-ID: Subject: Re: [PHP-DEV] RFC proposal for adding SORT_STRICT flag to array_unique() To: internals@lists.php.net Content-Type: multipart/alternative; boundary="00000000000087761e0642136aa6" From: jmarble@intuitivetechnology.com (Jason Marble) --00000000000087761e0642136aa6 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Here's a nice example inspired by Rob's comparison of object identity and value: https://gist.github.com/jmarble/c86b5b0b3373498c889bc9c5579105a8 On Sat, Oct 25, 2025 at 2:01=E2=80=AFPM Jason Marble < jmarble@intuitivetechnology.com> wrote: > Rob has convinced me SORT_STRICT is semantically incorrect. I agree > SORT_BINARY has merit, though I'm having difficulty with the implementati= on. > > I think I got too focused on _convention_ wanting to align naming > convention with the existing SORT_* flags. But a perfectly acceptable > alternative exists, ARRAY_UNIQUE_STRICT. > > I'm aware of the previous effort (https://externals.io/message/118952) > made regarding the flag ARRAY_UNIQUE_IDENTICAL. While this is technically > correct and follows existing convention (e.g. ARRAY_FILTER_USE_*), I > personally feel it's a bit awkward. > > ARRAY_UNIQUE_STRICT is, I think, a bit more intuitive. Especially today, > as `declare(strict_types=3D1)` has become more common and even encouraged= , > particularly for those who love PHPStan level max haha. > > Pull it, test it, break it. Let's do this! > > https://github.com/php/php-src/compare/master...jmarble:php-src:feature/a= rray-unique-sort-strict > > On Sat, Oct 25, 2025 at 7:41=E2=80=AFAM Morgan wro= te: > >> On 2025-10-26 00:16, Rob Landers wrote: >> >> > >> > Object identity and value are different things... >> https://3v4l.org/uZTsN >> > >> > >> >> >> $white =3D=3D new Color("white") >> >> That's comparing the values of the objects' properties (which may or may >> not be relevant to its "effective value" - the comparison applies to >> private properties as well) and considering the aggregate to be the >> "value of the object". >> >> Regardless, the comparison is certainly not useful to me (where >> recursively grovelling around in the objects' properties would be >> prohibitively expensive if not fatal), and doesn't make array_unique() >> any more helpful in deduplicating. >> > --00000000000087761e0642136aa6 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Here's a nice example inspired by Rob's comparison= of object identity and value:
https://gist.github.com/jmarble/c86b5b0= b3373498c889bc9c5579105a8

On Sat, Oct 25, 2025 at = 2:01=E2=80=AFPM Jason Marble <jmarble@intuitivetechnology.com> wrote:
Rob has convinced = me SORT_STRICT is semantically incorrect. I agree SORT_BINARY has merit, th= ough I'm having difficulty with the implementation.

I think I go= t too focused on _convention_ wanting to align naming convention with the e= xisting SORT_* flags. But a perfectly acceptable alternative exists, ARRAY_= UNIQUE_STRICT.

I'm aware of the previous effort (https://externals.io/mes= sage/118952) made regarding the flag ARRAY_UNIQUE_IDENTICAL. While this= is technically correct and follows existing convention (e.g.=C2=A0ARRAY_FI= LTER_USE_*), I personally feel it's a bit awkward.

ARRAY_UNIQUE_= STRICT is, I think, a bit more intuitive. Especially=C2=A0today, as `declar= e(strict_types=3D1)` has become more common and even encouraged, particular= ly for those who love PHPStan level max haha.

Pull it, test it, brea= k it. Let's do this!
https://github.com/php/php-src/compare/master...jmarble:php-src:featur= e/array-unique-sort-strict

On Sat, Oct 25, 2025 at 7:41=E2=80=AFAM Morga= n <Weedpacket@= varteg.nz> wrote:
On 2025-10-26 00:16, Rob Landers wrote:

>
> Object identity and value are different things... https://3v4l.org/uZTsN<= /a>
> <
https://3v4l.org/uZTsN>
>


=C2=A0 $white =3D=3D new Color("white")

That's comparing the values of the objects' properties (which may o= r may
not be relevant to its "effective value" - the comparison applies= to
private properties as well) and considering the aggregate to be the
"value of the object".

Regardless, the comparison is certainly not useful to me (where
recursively grovelling around in the objects' properties would be
prohibitively expensive if not fatal), and doesn't make array_unique() =
any more helpful in deduplicating.
--00000000000087761e0642136aa6--