Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118959 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 21668 invoked from network); 4 Nov 2022 09:05:48 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 4 Nov 2022 09:05:48 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 27E5E180210 for ; Fri, 4 Nov 2022 02:05:45 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-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,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 4 Nov 2022 02:05:44 -0700 (PDT) Received: by mail-wr1-f47.google.com with SMTP id bs21so6149903wrb.4 for ; Fri, 04 Nov 2022 02:05:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:user-agent:subject:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=oKLMHlOrJka3CrUAtdinO9sVD1TIq+3/Hcn2M4w7k44=; b=ZMQjEizSxJLRynUiSs8YJPZL2ysB5SeoLbqk1shgo58sNiq3Y1dhpZ7YXn5ho1oP69 DvVtc3mLu2R0/Vplj+K0ArmGPrcqkHbaJJ786j+1sVtgH3QfnEUIRrMKrgndxCdGH5vZ 7LhWniPRStlynzyeMZ5VC9prvfM6IT4s39Nf9qGbp1TXMrHtcbWLFU51F2m3Ie5ml7mv Wz5WviCbZIMUHbBYjEcgZudvLgspUZKPASkoM9qQB4E2E1iG29nAkQscqf3DNLyiDBL7 dfTByyWhghg+IZyCUtBx+AlJHEUwFgiouYpEYTzGvERiFnKdaVL3wQze40V8+TjQT9Pa 5j8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:user-agent:subject:to:from:date:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=oKLMHlOrJka3CrUAtdinO9sVD1TIq+3/Hcn2M4w7k44=; b=Io3D1POR/vjz3T5NT+S7liPTUYrh4gBOPbFdmcpJn9shN/u8OaAAOG0+MEm81OC0G8 +b64hzevAxWGP/PnBAR7aiUudKU/NEUurwv/i3sfyYP1zKAavj12h1jCqqW9PM3RP2Mu ExlDhragqh36uUpYtnB1Fkd0pbI7kI7LLbcE2xoGeQprnSKto/9pfYjDzAizPR1Be+oO EBAEYdoOZJM8emn2SwhBiZ+CzboAhuFyDQq2bb+TC4NfFwUUw/+lwI9wx+ikUfChYGPs 1X7PDUVRH8o7xjyPMJFJseo9mSVIRH8GjmxpFxi1uBDvi6WGylQpaWW1S6C6/2nT1I2x giZg== X-Gm-Message-State: ACrzQf1lnTTiligTh5AQ8sZh7UVzXnyrzIuV4KabpIBwcsV6DgZw2/kO yt0HsYmKQxto4AeIkHVzGJSoKXQYqhs= X-Google-Smtp-Source: AMsMyM7SMWmSzTXbwLQKVTH1slJF4wKCCXwNsSBTKspDnYhT2/UzXN7aZ4L0BKeiSaJoauJy/NACzg== X-Received: by 2002:adf:da4f:0:b0:236:cdd4:4ce2 with SMTP id r15-20020adfda4f000000b00236cdd44ce2mr16258428wrl.626.1667552743381; Fri, 04 Nov 2022 02:05:43 -0700 (PDT) Received: from [127.0.0.1] (cpc104104-brig22-2-0-cust548.3-3.cable.virginm.net. [82.10.58.37]) by smtp.gmail.com with ESMTPSA id z11-20020a05600c0a0b00b003b4868eb71bsm2459250wmp.25.2022.11.04.02.05.41 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Nov 2022 02:05:42 -0700 (PDT) Date: Fri, 04 Nov 2022 09:05:39 +0000 To: internals@lists.php.net User-Agent: K-9 Mail for Android In-Reply-To: References: Message-ID: <0053C284-958F-482E-A648-39652442D4B8@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] ARRAY_UNIQUE_IDENTICAL option From: rowan.collins@gmail.com (Rowan Tommins) On 3 November 2022 18:53:40 GMT, someniatko wrote: >You will have to memorize yet another PHP quirk, or be able to build a >logical chain: >- enums are non-comparable by default >- enums have no default string value (if not baked by a string) >- array_unique internally sorts an array >- default flag for array_unique compares the string representations of it= s items >- thus it won't work for enums in a general case Actually, I think this is already the case for "normal" objects - I had no= idea that array_unique used a string cast to compare objects, so am very s= urprised that it will not consider objects of completely different classes = unique, if they happen to have the same string value: https://3v4l=2Eorg/UG= CvB Making backed enums work with their backing value would be equally confusi= ng to me - Day::MONDAY and Month::JANUARY might both be backed by a 1, but = they are certainly distinct values=2E I'd much rather get an error that mad= e me check the manual and find a flag than have one of them silently discar= ded=2E Regards, --=20 Rowan Tommins [IMSoP]