Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109998 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 24649 invoked from network); 5 May 2020 09:17:21 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 5 May 2020 09:17:21 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A250D1804F6 for ; Tue, 5 May 2020 00:52:12 -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,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS 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-io1-f52.google.com (mail-io1-f52.google.com [209.85.166.52]) (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 ; Tue, 5 May 2020 00:52:12 -0700 (PDT) Received: by mail-io1-f52.google.com with SMTP id w4so991838ioc.6 for ; Tue, 05 May 2020 00:52:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=xy5UQ8p8vN167EheTKKKNS6NkShxaYXTp1WbtsKKrmE=; b=tib/zYeg4sEBHFh51ApfudLp/dwtlDImYuYtkc9AGckpUZZi8H2JBAERW5mW1D0jbW /ncYFXEBYt02zzAS10q4Cl+PVLWrkZK2kq/8GuAYoUUpEoOIxCPVrQ+MIlSx0K4by3sz hzkixdhhFHrQ5bK9fS7ZqNQEZKK51vX8vwkM3QMYgE6HCwjDn8kNDlN4WTgcQwyyLMyh cxQKRyeQpCFdIQrhVkzaaYNg1wYCslcfy6XMREL6tRvyT8//+Jbzz2k9kLl5m0ndR5Zp iXXD32oRMWCzDyPe06BddAbbcjydkscxHuHjosraOpJFi6MfwUBz6fSNYJpVjbPF5ie0 uIRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xy5UQ8p8vN167EheTKKKNS6NkShxaYXTp1WbtsKKrmE=; b=UWMgKgaxndzgc021PE3kSveNMx3moj3zGUhmybDxHJ6fb9rhT4SGhrqDqL2uDyblUt 49E8Edt/PIv/dQRmLgwYnR68aLU/SvwCZC0WhrsIsQdbtn/47QGtXscz3U7/qFMe807S lPOEwGzttpGnK3pDjhuinK9SzUc5K30Zegkd1H57sHwVOdejALsBCbMzmwTQWLIxF0jD sJxI63ATzcd0JVUHqIllQL3XkeduIlfhNXBFBxh13JEw5uaQF4Fwbl3lPCfSEyYQ+nRj 7zwnHK3tNP7l6adiNNty2PjrMl54UdSUE5WmTRIKCU60J5iMRE3CFISxDdWpIesJX8OV JCgg== X-Gm-Message-State: AGi0PuakjRdbEh8bBpn51uW6gD12CLaUvOGxZ3ohAFXix8+5Dz7eZe2w nvmyQ5qaBDVNpl6YgHXiV5+a1EaL X-Google-Smtp-Source: APiQypKH0JrhjDcizQI0JHkKeCDsOW25x9KiMWih+vlgVeysIqLFiqu7hZ650Wf3R2vJapDNDEevoA== X-Received: by 2002:a05:6602:15c4:: with SMTP id f4mr2211620iow.108.1588665129892; Tue, 05 May 2020 00:52:09 -0700 (PDT) Received: from mail-io1-f53.google.com (mail-io1-f53.google.com. [209.85.166.53]) by smtp.gmail.com with ESMTPSA id j2sm1048396ioo.8.2020.05.05.00.52.09 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 05 May 2020 00:52:09 -0700 (PDT) Received: by mail-io1-f53.google.com with SMTP id e9so965001iok.9 for ; Tue, 05 May 2020 00:52:09 -0700 (PDT) X-Received: by 2002:a02:a408:: with SMTP id c8mr2268791jal.143.1588665128831; Tue, 05 May 2020 00:52:08 -0700 (PDT) MIME-Version: 1.0 References: <9e3b1604-8d0a-9db4-aab6-e5f2198252f4@allenjb.me.uk> <3a2924d2-31b9-fee5-5548-49c889eca2f4@heigl.org> In-Reply-To: Date: Tue, 5 May 2020 08:51:33 +0100 X-Gmail-Original-Message-ID: Message-ID: To: Niklas Keller Cc: Rowan Tommins , PHP internals Content-Type: multipart/alternative; boundary="000000000000abe4c005a4e1ecad" Subject: Re: [PHP-DEV] Deprecating uniqid() From: phpmailinglists@gmail.com (Peter Bowyer) --000000000000abe4c005a4e1ecad Content-Type: text/plain; charset="UTF-8" On Tue, 5 May 2020 at 07:38, Niklas Keller wrote: > Rowan Tommins schrieb am Mo., 4. Mai 2020, > 10:59: > > Although the name sounds similar, I don't think UUID would be a good > > replacement for uniqid(). In my experience, it's used for things like > > generating ID attributes for HTML elements, or suffixes for table names, > or > > even file names; applications that really just need a few alphanumeric > > characters that are different each time. > > > > Seems like UUIDs would be a good fit for all of these. > For file names, absolutely. In many cases they have to be unique across all processes, and that's important. For the others I say a UUID is only a good replacement if taking a substring of a UUID is going to be unique. Take HTML element IDs. My experience is UUIDs (random data) doesn't compress well, and so shorter unique strings are preferable (also for reading the HTMl when debugging). The number of elements you're adding IDs to matters: if you add 10 then the UUID overhead is negligible; if you're adding to thousands it's different. For table name suffixes (if needed), the maximum length of a table name is 64 characters in MySQL. It's easier to cope with all systems if the table name pre-suffix can be more than 28 characters (27 if you put a separator between the table name and the suffix) For these reasons, I support adding a nice way to generate semi-unique data, preferably of user-defined length, and that doesn't have the drawbacks of uniqid(). And deprecating uniqid(). Peter --000000000000abe4c005a4e1ecad--