Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109068 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 83152 invoked from network); 16 Mar 2020 17:54:33 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 16 Mar 2020 17:54:33 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 15A3B18054D for ; Mon, 16 Mar 2020 09:17:01 -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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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-qt1-f175.google.com (mail-qt1-f175.google.com [209.85.160.175]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 16 Mar 2020 09:17:00 -0700 (PDT) Received: by mail-qt1-f175.google.com with SMTP id n5so14683629qtv.7 for ; Mon, 16 Mar 2020 09:17:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=benramsey.com; s=google; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=FFUruw8P5golPr83N/qc6N4hKodGHDbN4uBlbe0aZfY=; b=B4me094uimWvB9JZbwhCSrjBq18s80NCPZW+CO+gfxfSysWnX/D6Eq6CxPJZ/ZF5X8 HfD2bREuAWLEebpOZLhO+yZQKySoB+QObCBkrjlEHIar9/dGGE4St0c4zKtNIeQKBAFo 9ytSrTNcOFJWCRQPAejYs9+lvlKMkR6V1g/MkKYwC+e4PUufBunJSzROLLM0L6U+Zhzf Idi4WHwQyd6zxfQEhQqoQb/9UvSvSv/YrCq1VPjAg4E/n03Qq+c3AhkqWvkGD1Ur0wGO v4PNwYqwMPHpEkvS1e6xTFaPpn4ywk+4DmbtOnehlvB3OFkh3zd52sPlpHwtdQ63fwqn EdqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=FFUruw8P5golPr83N/qc6N4hKodGHDbN4uBlbe0aZfY=; b=Z2MLPlJdmSjEieyW4hK74Bq40nffWEwSBWlHMwo3sEG/Sirc9up3oKBVvFjmUUBnd/ gJ1WvIwyufhLZxr/A7q1ToYbRe8GAJ18K/O7NMHNhaKz4trStip8bfuUhDJ+ws6hau78 4IWsMEHrkgjyQ3GWqVTwwiF9PMd0mmHUvT595fkCpi3SWJeoE9efd+gvDLITqpvJQ7Le HLa9nmbA+MUoqY7J6vXuAf28BMl7zkW8tzTUhKBurBwVexWvq0t9I/k0vrM0fYwfE8j5 yWjqEgrEJKyeCbzAMKqdZv4TNnM8l/Bo4QsBrrFeFrvUknX6zDyKzhC30X29EHCuOLTn 5ouw== X-Gm-Message-State: ANhLgQ3BusiPLXirBvKtIrSB97y21+0hbBBAK7BPNr/a+GZOIhufB4QM p9j4Nmmd8D7ZrfmURXIC1//QOQ== X-Google-Smtp-Source: ADFU+vu5KmjGqNTvzSkOCqSXJydlLuEbNzb6rLfSHdlds/zyNYLoRi079qMdI/fvxbMpgLmQZjYLvA== X-Received: by 2002:ac8:4e94:: with SMTP id 20mr839166qtp.314.1584375417062; Mon, 16 Mar 2020 09:16:57 -0700 (PDT) Received: from [10.10.42.56] (h96-61-170-50.lvrgtn.dsl.dynamic.tds.net. [96.61.170.50]) by smtp.gmail.com with ESMTPSA id z6sm65053qka.34.2020.03.16.09.16.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Mar 2020 09:16:56 -0700 (PDT) Message-ID: Content-Type: multipart/signed; boundary="Apple-Mail=_7AB3F381-7E55-4E82-9DA8-049817BCCC98"; protocol="application/pgp-signature"; micalg=pgp-sha256 Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.60.0.2.5\)) Date: Mon, 16 Mar 2020 11:16:55 -0500 In-Reply-To: Cc: PHP internals To: Aran Reeks References: X-Mailer: Apple Mail (2.3608.60.0.2.5) Subject: Re: [PHP-DEV] [DISCUSSION] Native UUID support in PHP From: ben@benramsey.com (Ben Ramsey) --Apple-Mail=_7AB3F381-7E55-4E82-9DA8-049817BCCC98 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Mar 16, 2020, at 11:06, Aran Reeks wrote: >=20 > Hi Internals, >=20 > I'd like to open up a discussion around the implementation of a new > function within PHP for generating a UUID. >=20 > Whilst there are libraries out there already for PHP which can = generate a > UUID, all of those libraries have the possibility to generate IDs that > *could* have a collision. >=20 > The specification for UUID versions 1 and 2 allow for collision-free = ID > generation by incorporating the unique MAC addresses from network = cards - > something which can't be accessed from PHP code at present. >=20 > I can see two possible methods to enable this; >=20 > - New function added to PHP which exposes the MAC address (allowing > external implementations for UUIDs, as well as other possible = purposes a > MAC address could be used). >=20 > - A new PHP function which introduced a uuid() function which will > generate and return version-compliant UUIDs. >=20 > - Both of the above. >=20 > Thoughts and feedback welcome to kickstart conversations and if = there's a > positive consensus, I'd like to put forward an RFC for this to be > introduced in PHP 8. >=20 While undocumented, PHP has the method `net_get_interfaces()` (since PHP = 7.3.0). It uses `getifaddrs()` on Linux and `GetAdaptersAddresses()` on = Windows to create an array of network interface addresses. See = https://github.com/php/php-src/commit/7ca5a7d84ebdc1b97f49cb460f200db093b9= 6d9d Right now, the address is only added when it is an IPv4 or IPv6 address. = It just needs to be modified to look for the correct =E2=80=9Cfamily=E2=80= =9D and set that as the =E2=80=9Cmac=E2=80=9D array value for the = interface. I=E2=80=99m currently working on a patch for this, so this might help = with one aspect of your proposal. Cheers, Ben --Apple-Mail=_7AB3F381-7E55-4E82-9DA8-049817BCCC98 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- iHUEAREIAB0WIQToXQMR3fpbrPOmEOewLZeYnIwHGwUCXm+mdwAKCRCwLZeYnIwH G2hNAP9c8QfAb+nk6bCyITlCkiQXM2BxNgJblCSfd6oqF/f4ggEAljKCUEe5dl0r r0FJiVc/cpTPEIf62WruwXe3ksMqqMM= =Q1O2 -----END PGP SIGNATURE----- --Apple-Mail=_7AB3F381-7E55-4E82-9DA8-049817BCCC98--