Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:95830 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 90566 invoked from network); 9 Sep 2016 08:37:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Sep 2016 08:37:32 -0000 Authentication-Results: pb1.pair.com header.from=arvids.godjuks@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=arvids.godjuks@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.54 as permitted sender) X-PHP-List-Original-Sender: arvids.godjuks@gmail.com X-Host-Fingerprint: 74.125.82.54 mail-wm0-f54.google.com Received: from [74.125.82.54] ([74.125.82.54:38360] helo=mail-wm0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 84/0E-61313-BC472D75 for ; Fri, 09 Sep 2016 04:37:32 -0400 Received: by mail-wm0-f54.google.com with SMTP id 1so19604467wmz.1 for ; Fri, 09 Sep 2016 01:37:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=FHd3nWBjDm2bX+qx3JPZGTZJsRYfzGzYXQMw6hu1Zag=; b=ysLoUbJpmfmGlCgfCLKCHBF0q+evcXU/jpCK8Bv0FKW4d9XygEiuopavux4LwdNU7G nZ/SSyPVXD4zXmTdJ/DNy7BQBnL729Ww7PjmBHgryzRbo6PSjflB+7CzQLTVfeIUpDvU NGaVDbNNkWT5AXPwK5/HlmqVWcsMB6HCPNIlCuXskrzxReiRscyEaUVQZZR8eA6bYbvq ZVPGltU2W9Dw3OqQWBgvvsJzh1dueMwBTWLRr9NoeiEg5c5vMkAlaaFrjhsVptRV3KCV OHNgaXYDnGY5K0Y0nKzViyDwWXVma/zZvo5ExY59i3JwyN/M1ZV8cyxka+FInGCn6FK3 jvIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=FHd3nWBjDm2bX+qx3JPZGTZJsRYfzGzYXQMw6hu1Zag=; b=VoZ3fxKm64KhxLF3zul/G53tux0jb8awGhgB+JlkMRDdgWKWvPbp6d0etesapsMdqy TEf95KXQ5crzWxd8LJnnJGd0tn9RBd4MRvsUUlJOh3tYaYIhhhzD1coX6EfpVFcy1kWd EQ9AFD344DuU840ns2qXDXncROWoLd4bNOzHEM4ERHuekRa6ViFZbWxqILySQ9+KksEf CjCZwt0WtBYkU5SdpW7LyM3pWvCyDDKUKe8nO5yLm4cWzm7jSivM4Pf8kIuHM2EeBlg8 MaQ633ODsSE+Hcwz5wFl9qQjczqiJwolnANRtMVdiuNQwpIqonIjkry4IIP9e36KoL/x /PjA== X-Gm-Message-State: AE9vXwMvWsVYLSO/7C11SxJrxZ23kyLL7152szCTlZwXaT/f8+iJjX79FZWrxaDkj5N5cAN/0Kc1Y38jvhTQHQ== X-Received: by 10.28.27.15 with SMTP id b15mr1617881wmb.81.1473410247834; Fri, 09 Sep 2016 01:37:27 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.97.3 with HTTP; Fri, 9 Sep 2016 01:36:57 -0700 (PDT) In-Reply-To: References: Date: Fri, 9 Sep 2016 11:36:57 +0300 Message-ID: To: Yasuo Ohgaki Cc: Niklas Keller , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a114b3dce6e597c053c0f0e05 Subject: Re: [PHP-DEV] [RFC] Make uniqid() more unique From: arvids.godjuks@gmail.com (Arvids Godjuks) --001a114b3dce6e597c053c0f0e05 Content-Type: text/plain; charset=UTF-8 2016-09-09 11:07 GMT+03:00 Yasuo Ohgaki : > On Fri, Sep 9, 2016 at 4:40 PM, Niklas Keller wrote: > > I think it's better to leave it as is and deprecate and discourage its > use. > > There's already a big warning there. Dunno whether there are really valid > > use cases for it. > > uniqid() is handy, when developer would like to sort something by > "time" prefix/postfix in strings. For example, prefixed/postfixed > session ID by "time". > > So E_DEPRECATE might be too much. > > Regards, > > -- > Yasuo Ohgaki > yohgaki@ohgaki.net > It's also useful in other cases, where using a full blown true random source is just overkill. For example, my recent usage was to use the result of uniqid('', true) as a few parameters in URL's instead of plain numeric ID. Client just wanted to users can't do a +1 and see someone else's result page that might have a different text or a different campaign even. And I do need to generate those id's in bursts - 200 to 600 id's in a single action, I would imagine generating 600 random strings of ~20 char length can be hard on the source of the randomness, may even deplete it. And I expect the numbers to grow. So, deprecating it I think is really an overreaction. It's a handy tool. It can be used to generate filenames too, and a lot of other stuff. My thoughts are - improve it. Yes, the standard uniqid() is a bit too short, I have never used it without the second "true" parameter and that dot in the middle of the string is annoying - I had to strip it out every use case I had. Arvids. --001a114b3dce6e597c053c0f0e05--