Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128992 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 554E21A00BC for ; Tue, 28 Oct 2025 21:59:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1761688798; bh=aDj/UkjkRab9glhfkdIUztfKKZ5wt0GNYSnJSCUsMqk=; h=References:In-Reply-To:From:Date:Subject:To:From; b=Z5mZpRqwLbtjb7SHW15xBk82Jp29BsEGotGGPa85eMUuEYKyBfjUSN3Hmwx6+I9DD /UBtvHuMGxSZtZlP9X3g8ZptNtbrUwt+zNcp7NAAKsGLRWdD8ER8p3TVtcaDGjMn9K GT55JIiv1HRlt5iJ6n82TwwbuXk5YrWfQO6LTdqgrXkxrbnImpNDpl35DBL8Dr8Zdc EsXlOrUYA4OUI1cgiwPtaabrBk8R7gaUQ+Jr0TXw/x5vikqeA73+AHoDLXousb0DDP N9m2P62is+UI9XrcBgY+4upb9HG2RWqGlpQyryaT7SiI7ZxucSTKN9AanCVWQ5ODq4 eo7v31tztqkEg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D52FC180056 for ; Tue, 28 Oct 2025 21:59:57 +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_DNSWL_NONE,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-f49.google.com (mail-yx1-f49.google.com [74.125.224.49]) (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 ; Tue, 28 Oct 2025 21:59:57 +0000 (UTC) Received: by mail-yx1-f49.google.com with SMTP id 956f58d0204a3-63e2c7a3d10so7171721d50.2 for ; Tue, 28 Oct 2025 14:59:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intuitivetechnology.com; s=google; t=1761688792; x=1762293592; 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=jTOjeHGXPxzxsrErko5g1e2PZEbx6gmbmOpg6g/zj2M=; b=H3VY5WETsqu9NLjKBPKigjSE+qSMs6o2kwRiIXaCO+S4WXaugDxplMcFhFdXiAdgFB i0w0Ly6RDYX23M0vvQZGX4Edztb3e04XBKtH0prLv2W5CFpycAKJJ/PzEUFIDVWW33iB R/KDACb+uZAOM3JC4NBrXNdzTg9+aWfEVMsZDVzr8zwma98fzcMRLSK+pEl+RGmDzJO/ WaOPjAB15TKm7O32hphs1QH4esMlKJv8OXCgaEr1WoYZ2385TOAfe36rMB635ONKc1o+ dr8UM09jHXN62G/TJMlpGtTlu/sN2jzKiePfHjg+0LgL4LurTvLBL7ifligr2e9awpks Eyqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761688792; x=1762293592; 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=jTOjeHGXPxzxsrErko5g1e2PZEbx6gmbmOpg6g/zj2M=; b=Qj9Sgp8XqCJL9IfRq3Milduj6hpb45s4uFiZfbFgFdLohDM/Zyg+C1nbYvj0CY0TQ1 WyVjTvMwemwg6GyEArBS92gbzWfCp1nTHVE4fGrgPO3HtP3NGQpE+Jj9eQWMFnpHZ/Cb yA3vvB+5OSpf4jz5dlBI7JjGvXn3mduEDlRMU39zH9RMtJWPz/dRn69J3NA1cleYhsXV aoqtTulGodI9oykbZp9Cten5y28+t4Pa6uR9OLRWthJfb4gha+d+Vw01FnXJ2Bf0loN5 Px4aLzTdApS0zEf7yjidLBTA9F3c+qvxlKZJxW8S9TATOwptI8aOAq9lWZoR1qH/i62x j7zg== X-Gm-Message-State: AOJu0Yxx3Jeag7zl2O4fX4lpbQpXi1nqWamQiJ6x1bMcUG2Q9pUO8/7O Sepd9BkhQcnPKPxj/ZUZcaIxU3oaEi4SsL1Hy15ojQM6K2Sru4Nk+i8f3ZF8HZiKEENs4AcHnq2 9/eWO6PHTsIMXZv3e9/4VJt4BZDyKLxWCWno5izDMjTaOUPuX8Umu X-Gm-Gg: ASbGncvcU20ijiEjs6P37MShh20dDdMvEIhtzs32dg43Z7U/4vmEoTZrI/P3TWb2AV+ wrVrv5XeHMq/+jtQ4mZ59LlAbAJRv8uvq9HSCpi7rUGZiD5tWQYb4bJS7xu59AmR95yC3r2Az0x 0fMG64Zo6UZxl3CXK++/2WK7K6O0gd4tWGfxmn+Y73x0CN2VT7WKsvIOtgsE58go2korX4LzqUY diagJck4iCYaXbUzrJmQOmDZT1iTKGRaa2mSgGpHTiWwPQ8S387nmNEyia17FsmxEwy3/el X-Google-Smtp-Source: AGHT+IE1eZwE7DNCQcO4jw3HM+B5jQM0R/AosRKCfwRmXlro1EH4u98xpUEGLwuCBlJGX+NJRuD+bPjLyo+Tg81WR/A= X-Received: by 2002:a05:690e:d86:b0:63e:2e7e:ca2f with SMTP id 956f58d0204a3-63f76dd52damr921292d50.42.1761688791660; Tue, 28 Oct 2025 14:59:51 -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: Tue, 28 Oct 2025 14:59:40 -0700 X-Gm-Features: AWmQ_bnyI5OKkdqr7kIncjoin5BZZGzNVway8dgP-utNnsneEHSCgq2ZfXms9e0 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="000000000000a1c8a906423f2293" From: jmarble@intuitivetechnology.com (Jason Marble) --000000000000a1c8a906423f2293 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable If someone can grant me Karma (username jmarble), I'm happy to start the process of submitting an RFC for an ARRAY_UNIQUE_STRICT flag. Thank you! On Sun, Oct 26, 2025 at 10:50=E2=80=AFAM Jason Marble < jmarble@intuitivetechnology.com> wrote: > 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 implementat= ion. >> >> 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 technicall= y >> 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 encourage= d, >> 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/= array-unique-sort-strict >> >> On Sat, Oct 25, 2025 at 7:41=E2=80=AFAM Morgan wr= ote: >> >>> 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 ma= y >>> 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. >>> >> --000000000000a1c8a906423f2293 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
If someone can grant me Karma (username jmarble), I'm = happy to start the process of submitting an RFC for an ARRAY_UNIQUE_STRICT = flag.
Thank you!

On Sun, Oct 26, 2025 at 10:50=E2= =80=AFAM Jason Marble <jmarble@intuitivetechnology.com> wrote:
Here's a nice example= inspired by Rob's comparison of object identity and value:
https://gist.github.com/jmarble/c86b5b0b3373498c889bc9c5579105= a8

On Sat, Oct 25, 2025 at 2:01=E2=80=AFPM Jason Marble <jmarble@intuitivet= echnology.com> wrote:
Rob has convinced me SORT_STRICT is semantica= lly incorrect. I agree SORT_BINARY has merit, though I'm having difficu= lty with the implementation.

I think I got too focused on _conventio= n_ 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 regar= ding the flag ARRAY_UNIQUE_IDENTICAL. While this is technically correct and= follows existing convention (e.g.=C2=A0ARRAY_FILTER_USE_*), I personally f= eel it's a bit awkward.

ARRAY_UNIQUE_STRICT is, I think, a bit m= ore intuitive. Especially=C2=A0today, as `declare(strict_types=3D1)` has be= come more common and even encouraged, particularly for those who love PHPSt= an 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/array-unique-sort-strict<= /a>

On 2025-10-26 00:1= 6, 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.
--000000000000a1c8a906423f2293--