Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:96536 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 28691 invoked from network); 21 Oct 2016 07:57:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Oct 2016 07:57:08 -0000 Authentication-Results: pb1.pair.com header.from=yohgaki@ohgaki.net; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=yohgaki@ohgaki.net; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ohgaki.net designates 180.42.98.130 as permitted sender) X-PHP-List-Original-Sender: yohgaki@ohgaki.net X-Host-Fingerprint: 180.42.98.130 ns1.es-i.jp Received: from [180.42.98.130] ([180.42.98.130:48645] helo=es-i.jp) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A2/00-28528-05AC9085 for ; Fri, 21 Oct 2016 03:57:06 -0400 Received: (qmail 79888 invoked by uid 89); 21 Oct 2016 07:50:19 -0000 Received: from unknown (HELO mail-qt0-f180.google.com) (yohgaki@ohgaki.net@209.85.216.180) by 0 with ESMTPA; 21 Oct 2016 07:50:19 -0000 Received: by mail-qt0-f180.google.com with SMTP id f6so78881286qtd.2 for ; Fri, 21 Oct 2016 00:50:19 -0700 (PDT) X-Gm-Message-State: ABUngvfPd3GsKLI6U++ZULlmMBDi0iwALFMk+rbWBFmc9a62x4VOGKI+5GmCdl9dVcT2IkaCTq9qq5ep619Tyg== X-Received: by 10.237.37.68 with SMTP id w4mr4097693qtc.112.1477036213303; Fri, 21 Oct 2016 00:50:13 -0700 (PDT) MIME-Version: 1.0 Received: by 10.140.22.38 with HTTP; Fri, 21 Oct 2016 00:49:32 -0700 (PDT) In-Reply-To: References: <070001d2295e$76b7d730$64278590$@belski.net> <075a01d22993$9efc6c80$dcf54580$@belski.net> <088801d229fa$d7320cb0$85962610$@belski.net> Date: Fri, 21 Oct 2016 16:49:32 +0900 X-Gmail-Original-Message-ID: Message-ID: To: Pierre Joye Cc: Kalle Sommer Nielsen , Anatol Belski , Joe Watkins , Niklas Keller , Leigh , PHP Internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Re: [RFC][DISCUSSION] Improve uniqid() uniqueness From: yohgaki@ohgaki.net (Yasuo Ohgaki) Hi Pierre, On Thu, Oct 20, 2016 at 7:12 PM, Pierre Joye wrote: >> Application requires unique ID under across multi process/thread >> tasks, it will have more chance to have collided unique ID. > > uniqid fill(s|ed) some needs or maybe still fits for some. > > However for modern application with many concurrent requests or nodes, > it does not fit anymore, since long. Do we need to fix a broken hammer > to fix the screw? I do not think so. > I'm all for bringing UUID to PHP by default, encourage users to use it for applications requires very unique ID. Let's have UUID module by default someday! > I suggested already to simply improve it if we can do it without > breaking BC and recommend to use something designed for such tasks, > UUID. ramsey/uuid is one of them, other are available. I'm aware of that entropy must be enabled by default, too. I guess you feel uniqid() improvement is impossible due to vote. You could be right about it. As far as I searched, there is no code have problem even when entropy on/off and additional chars/format. (Found one test script that tests uniqid(). Cannot tell if db has char(13) or like, though) We made rand() a alias of mt_rand(). IMHO, we are better not to leave _too_ weak unique ID generation function alone. HTML ID attribute and test data ID is common uniqid() use case. Let's make it reasonably unique for ID attributes, test database unique values, etc. Regards, P.S. If uniqid() is a "Shouldn't use function", we don't have to care little BC too much. Making it a "Can use function" for proper purposes is reasonable choice. I'm +1 for deprecating and removing uniqid(), but I presume it will never happen. That's why I'm trying to improve it. -- Yasuo Ohgaki yohgaki@ohgaki.net