Re: [PHP-DEV] Deprecating uniqid()

2020-05-07 Thread Dik Takken
On 07-05-2020 17:24, Larry Garfield wrote: > Between preloading, PHP 7's improvements, FFI funkiness, and the upcoming > JIT, there's been on and off discussion about moving much of the standard > library from C to "PHP code that is bundled and preloaded automatically." A > real "standard libr

Re: [PHP-DEV] Deprecating uniqid()

2020-05-07 Thread Arvids Godjuks
Hello Ben, On Thu, 7 May 2020 at 17:29, Ben Ramsey wrote: > > On May 7, 2020, at 09:33, Dan Ackroyd wrote: > > *snip* > > I’m done waxing philosophical, so what I can say about `uniqid()`? > > This is one of those functions I think (without doing the research) is > used a lot in CLI scripts and

Re: [PHP-DEV] Deprecating uniqid()

2020-05-07 Thread Ben Ramsey
> On May 7, 2020, at 09:33, Dan Ackroyd wrote: > > On Thu, 7 May 2020 at 10:13, Rowan Tommins wrote: >> >> Unless we're actively trying to shrink the functionality of PHP's core, > > I think we should. > > There are things that were added to core rather than done in userland because: > > * d

Re: [PHP-DEV] Deprecating uniqid()

2020-05-07 Thread Larry Garfield
On Thu, May 7, 2020, at 9:33 AM, Dan Ackroyd wrote: > On Thu, 7 May 2020 at 10:13, Rowan Tommins wrote: > > > > Unless we're actively trying to shrink the functionality of PHP's core, > > I think we should. > > There are things that were added to core rather than done in userland because: > > *

Re: [PHP-DEV] Deprecating uniqid()

2020-05-07 Thread Dan Ackroyd
On Thu, 7 May 2020 at 10:13, Rowan Tommins wrote: > > Unless we're actively trying to shrink the functionality of PHP's core, I think we should. There are things that were added to core rather than done in userland because: * distributing libraries in userland used to be a lot harder than it is

Re: [PHP-DEV] Deprecating uniqid()

2020-05-07 Thread Rowan Tommins
On Wed, 6 May 2020 at 13:40, Dan Ackroyd wrote: > This is a problem that would be better solved in userland rather than > trying to design and evolve inside core PHP. > I think that's a major philosophical question: should the core of a language provide only those most basic building blocks fro

Re: [PHP-DEV] Deprecating uniqid()

2020-05-06 Thread Aleksander Machniak
On 06.05.2020 14:44, Nikita Popov wrote: > A possible candidate for this would be ULID (https://github.com/ulid/spec), > which is basically timestamp + random + base32 encoding. The timestamp part > makes ULIDs approximately lexicographically orderable, the random part > makes sure things are uniqu

Re: [PHP-DEV] Deprecating uniqid()

2020-05-06 Thread Nikita Popov
On Wed, May 6, 2020 at 2:34 PM Rowan Tommins wrote: > On 5 May 2020 09:42:19 BST, Arvids Godjuks > wrote: > >So in my opinion, a better replacement for uniqid is needed - have it > >generate a bigger string with more entropy and better underline algorithm, > >but it being time-based should be a

Re: [PHP-DEV] Deprecating uniqid()

2020-05-06 Thread Dan Ackroyd
On Wed, 6 May 2020 at 13:34, Rowan Tommins wrote: > > On 5 May 2020 09:42:19 BST, Arvids Godjuks wrote: > >So in my opinion, a better replacement for uniqid is needed - > > You're right that the requirements for "random" and "unique" are distinct. > Perhaps what we need is a unique_string functi

Re: [PHP-DEV] Deprecating uniqid()

2020-05-06 Thread Rowan Tommins
On 5 May 2020 09:42:19 BST, Arvids Godjuks wrote: >So in my opinion, a better replacement for uniqid is needed - have it >generate a bigger string with more entropy and better underline algorithm, >but it being time-based should be a thing stiff. And do not call it a >"random_string" or something,

Re: [PHP-DEV] Deprecating uniqid()

2020-05-05 Thread Arvids Godjuks
On Tue, 5 May 2020 at 10:26, Rowan Tommins wrote: > On Tue, 5 May 2020 at 08:52, Peter Bowyer > wrote: > > > > > 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 b

Re: [PHP-DEV] Deprecating uniqid()

2020-05-05 Thread Rowan Tommins
On Tue, 5 May 2020 at 08:52, Peter Bowyer wrote: > > 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 f

Re: [PHP-DEV] Deprecating uniqid()

2020-05-05 Thread Peter Bowyer
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 element

Re: [PHP-DEV] Deprecating uniqid()

2020-05-04 Thread Niklas Keller
Rowan Tommins schrieb am Mo., 4. Mai 2020, 10:59: > On Mon, 4 May 2020 at 06:27, Andreas Heigl wrote: > > > > > As replacement I could think of showing people the way to UUIDs. > > > > > Although the name sounds similar, I don't think UUID would be a good > replacement for uniqid(). In my experi

Re: [PHP-DEV] Deprecating uniqid()

2020-05-04 Thread Rowan Tommins
On Mon, 4 May 2020 at 06:27, Andreas Heigl wrote: > > As replacement I could think of showing people the way to UUIDs. > 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 e

Re: [PHP-DEV] Deprecating uniqid()

2020-05-03 Thread Andreas Heigl
Hey Ben, hey all Am 02.05.20 um 21:13 schrieb Ben Ramsey: >> On May 2, 2020, at 13:57, AllenJB wrote: >> >> Hi all, >> >> I'd like to discuss deprecating uniqid() >> >> I believe it's dangerously bad a doing "what it says on the tin". New >> developers still reach for it and do not read the warn

Re: [PHP-DEV] Deprecating uniqid()

2020-05-03 Thread Jakob Givoni
On Sun, May 3, 2020 at 2:57 PM Rowan Tommins wrote: > > A common suggestion is to use binhex(random_bytes($desired_length / 2)), > which isn't particularly elegant, and in my experience, the main > requirement is "a unique string of printable/alphanumeric characters, so > limiting to [0-9a-f] is j

Re: [PHP-DEV] Deprecating uniqid()

2020-05-03 Thread Niklas Keller
Hey Allen, there's been discussion on whether we should deprecate or replace its functionality. Without changing the output format, it's impossible to have enough entropy. Without consensus on the best way forward, I've just never cared to put this to a vote. I'll happily collaborate on moving t

Re: [PHP-DEV] Deprecating uniqid()

2020-05-03 Thread Rowan Tommins
On 03/05/2020 09:54, Jakob Givoni wrote: I'm using this function frequently, but I am ok with deprecating it as I think the name is dangerously misleading - basically, anything that mentions "unique" without saying to what, is a misnomer. However, as it's useful to have a function in core that gi

Re: [PHP-DEV] Deprecating uniqid()

2020-05-03 Thread Jakob Givoni
On Sat, May 2, 2020 at 9:58 PM Nikita Popov wrote: > > On Sat, May 2, 2020 at 9:13 PM Ben Ramsey wrote: > > > > On May 2, 2020, at 13:57, AllenJB wrote: > > > > > > Hi all, > > > > > > I'd like to discuss deprecating uniqid() > > > > > > I believe it's dangerously bad a doing "what it says on th

Re: [PHP-DEV] Deprecating uniqid()

2020-05-02 Thread Nikita Popov
On Sat, May 2, 2020 at 9:13 PM Ben Ramsey wrote: > > On May 2, 2020, at 13:57, AllenJB wrote: > > > > Hi all, > > > > I'd like to discuss deprecating uniqid() > > > > I believe it's dangerously bad a doing "what it says on the tin". New > developers still reach for it and do not read the warning

Re: [PHP-DEV] Deprecating uniqid()

2020-05-02 Thread Ben Ramsey
> On May 2, 2020, at 14:13, Ben Ramsey wrote: > >> On May 2, 2020, at 13:57, AllenJB wrote: >> >> Hi all, >> >> I'd like to discuss deprecating uniqid() >> >> I believe it's dangerously bad a doing "what it says on the tin". New >> developers still reach for it and do not read the warnings o

Re: [PHP-DEV] Deprecating uniqid()

2020-05-02 Thread Ben Ramsey
> On May 2, 2020, at 13:57, AllenJB wrote: > > Hi all, > > I'd like to discuss deprecating uniqid() > > I believe it's dangerously bad a doing "what it says on the tin". New > developers still reach for it and do not read the warnings on the manual page > (or if they do, don't fully understan

[PHP-DEV] Deprecating uniqid()

2020-05-02 Thread AllenJB
Hi all, I'd like to discuss deprecating uniqid() I believe it's dangerously bad a doing "what it says on the tin". New developers still reach for it and do not read the warnings on the manual page (or if they do, don't fully understand how bad it is). For older codebases that still rely on i