Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110072 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 51178 invoked from network); 7 May 2020 16:53:32 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 7 May 2020 16:53:32 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4898A1804C3 for ; Thu, 7 May 2020 08:28:59 -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_H3,RCVD_IN_MSPIKE_WL,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-f181.google.com (mail-qt1-f181.google.com [209.85.160.181]) (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 ; Thu, 7 May 2020 08:28:58 -0700 (PDT) Received: by mail-qt1-f181.google.com with SMTP id q13so527025qtp.7 for ; Thu, 07 May 2020 08:28:58 -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=pjYaUzwaE0uXJotoOTqTFaRjB36W05UwN6XBzQB/NHg=; b=OOnbcJMIpUrSD09FODwTz+DTKzCQOza2QT7b6qnkX+zryvkS1H2MOPdMBUcA3QgUBw FH0a0tzKB7Ti+KQ1cVjalfUMBd/zHits+mXaz0kAKWASiQkkWz1ttlRBBiKZTSFV6PSt n/GmQlihd/gLCQBB4zoCWNofldUhVgzBVVNlUXhSJLHv5gzM95DgBP50BTqb5VSmPDdp d5Jmh9hKfHTaDUfe2ouuDkd9Wrq9iUAg5omzIGgH8ySFTwOQWsTlHU9on/niYX7tPc8Q CPFO3naidqpiEiV5EefEPnODY9OI7WLPmb9/jNAwH1MjpWn5j0xaXRXCN3RfzRZSsjLO DziQ== 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=pjYaUzwaE0uXJotoOTqTFaRjB36W05UwN6XBzQB/NHg=; b=a6+AHLgZDrkBrUa7dkXL0aU7yd5H6BMblxnkdzewY7ETo06Vf3bpPnzibA36JoA7Tr nzLSW0EmxJgZzh2pJKIKx7GgnVHwNmH9Tk1Mbag1rYc4T2llxWVQT4qSGmal5PZFJeha f7GaYXtVBHGZ934Tuirt5T5J0SW7a13E5AiwFYZruciBAJIBwtGz1i5rb5RZgClpeUNT VOMwZSSn2nTvP6mfVBUsS07qBaTAFHQHUWjasHp3wdgev7NQ7Jm/zB3ya1+M5hxx7HLi kXFID9rvNcp6Cz6wXNf1PiHI5ZOt5LyjM/cO7DKWRIcynpseso260+yAsHt/BxSmWNo4 SQZQ== X-Gm-Message-State: AGi0Puavlb+w6lCX2iQHti7uDCt1ZiJxoBW1BZUog1EpXnx1aFQiRVqU 112k4Hbn8Wi9Q0PyL0btRw4GPg== X-Google-Smtp-Source: APiQypIpM9gfClYvF8YJl/jhQTgOlqHjJD5MLZVPWQLoZv50164nsd6E49cqm16uyaGe5lge801gfg== X-Received: by 2002:ac8:5204:: with SMTP id r4mr14702802qtn.39.1588865336101; Thu, 07 May 2020 08:28:56 -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 l2sm4477174qkd.57.2020.05.07.08.28.54 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 May 2020 08:28:54 -0700 (PDT) Message-ID: <456FDEDB-770E-41A0-9B15-46768232F2C2@benramsey.com> Content-Type: multipart/signed; boundary="Apple-Mail=_7E4AA846-4E63-4496-8324-83FC36AC15D6"; protocol="application/pgp-signature"; micalg=pgp-sha256 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Date: Thu, 7 May 2020 10:28:53 -0500 In-Reply-To: Cc: Rowan Tommins , PHP internals To: Dan Ackroyd References: <9e3b1604-8d0a-9db4-aab6-e5f2198252f4@allenjb.me.uk> <3a2924d2-31b9-fee5-5548-49c889eca2f4@heigl.org> X-Mailer: Apple Mail (2.3608.80.23.2.2) Subject: Re: [PHP-DEV] Deprecating uniqid() From: ben@benramsey.com (Ben Ramsey) --Apple-Mail=_7E4AA846-4E63-4496-8324-83FC36AC15D6 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On May 7, 2020, at 09:33, Dan Ackroyd wrote: >=20 > On Thu, 7 May 2020 at 10:13, Rowan Tommins = wrote: >>=20 >> Unless we're actively trying to shrink the functionality of PHP's = core, >=20 > I think we should. >=20 > There are things that were added to core rather than done in userland = because: >=20 > * distributing libraries in userland used to be a lot harder than it = is now. >=20 > * Some stuff needed to be in core to give adequate performance. As > userland PHP has had it's relative performance increased, and also > computers have gotten a little faster since the project began*, that > need has been greatly reduced. >=20 > So although the choice to provide some functionality in core was the > correct choice at the time, it would not be a correct choice to do > now. >=20 > The reason to try to reduce the amount of core code is that > maintaining core code is much more difficult than maintaining userland > libraries. >=20 > There are swathes of PHP core that are scary to fix bugs in, let alone > think about adding new features or refactoring their API. >=20 > Although each removal would need to be justified individually, I think > as a general aim 'more userland, less core' is good. In many ways, I agree. In other ways, I see things like `array_column()` = and `str_contains()`[1] as being obvious additions to the core, since = they=E2=80=99re implemented in userland so often. However, we recently = rejected the Server-side Request and Response Objects RFC[2], so what is = the over-arching philosophy that drives our decisions? I don=E2=80=99t know the answer to this, but I think it might be a good = exercise to consider it. It=E2=80=99s probably different for each person = here. I think Paul Jones attempted to call attention to this in the = _epilogue_ to the =E2=80=9CServer-side Request and Response Objects=E2=80=9D= vote[3]: > The initial impression is that there is a strong desire for work > that can be done in userland to stay in userland. However, that > impression conflicts with the recent acceptance of str_contains(), > which is very easily done in userland. > > **Lesson:** Of functionality that can be accomplished in userland, > only trivial/simple functionality is acceptable. I reject the conclusion (=E2=80=9Clesson=E2=80=9D) here, but it=E2=80=99s = difficult not to arrive at this conclusion based on the observations. It = might be interesting to flip this around, though, in the case of the = request/response objects vote. Maybe this specific lesson could be = better stated as: > **Lesson:** Of functionality that can be accomplished in userland, > functionality viewed as having a high maintenance overhead is best > left in userland. I don=E2=80=99t know whether that=E2=80=99s the correct lesson, either, = but I think it helps illustrate that we=E2=80=99re all approaching these = decisions from our own philosophical points of view for what should or = shouldn=E2=80=99t be PHP, and what appears to be the guiding = principle(s) to one may be the opposite (flipped) to another. So, where am I going with this? I really have no idea. I thought I had a point about trying to = articulate some overarching philosophy for the direction of PHP, but now = that I=E2=80=99ve gotten here, I think I=E2=80=99ve convinced myself = that one of PHP=E2=80=99s strengths is that it has no guiding = philosophy. Each person here brings with them their own philosophies of = how the language should be shaped, and even those philosophies may = change and contradict themselves from time-to-time, and that=E2=80=99s = what=E2=80=99s made the language what it is today, and perhaps that=E2=80=99= s what continues to make the language better. While it would be nice to understand the rationale behind decisions for = what goes into core and what comes out, the reality is people are making = these decisions and we don=E2=80=99t get things right all of the time, = but we do get things right much of the time. I think =E2=80=9CAllow = trailing comma in parameter list[4]=E2=80=9D and =E2=80=9CAdd = str_starts_with() and str_ends_with() functions[5]=E2=80=9D might be = good examples of this. I=E2=80=99m 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 tooling. As a result, it may be impossible = to do good research on this, since these scripts are probably not = available in public repositories. Additionally, when I write scripts = like this, I don=E2=80=99t reach out for Composer packages, since I = don=E2=80=99t need the overhead of a full-blown project or library, and = I doubt others do, as well. This means allowing userland to fill the = void left by the removal of `uniqid()` may not be a good option. I think we should err on the side of BC with `uniqid()`. While the = manual says it=E2=80=99s been in the language since PHP 4, the research = I did in the =E2=80=9Cmuseum=E2=80=9D shows that it=E2=80=99s been in = PHP since 2.0b9 (see the Changelog in the tarball for 2.0b10[6]). Is there any way we can improve this function without = deprecating/removing it? Cheers, Ben [1]: https://wiki.php.net/rfc/str_contains [2]: https://wiki.php.net/rfc/request_response [3]: https://externals.io/message/109563 [4]: https://wiki.php.net/rfc/trailing_comma_in_parameter_list [5]: = https://wiki.php.net/rfc/add_str_starts_with_and_ends_with_functions [6]: https://museum.php.net/php2/php-2.0b10.tar.gz --Apple-Mail=_7E4AA846-4E63-4496-8324-83FC36AC15D6 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----- iHUEAREIAB0WIQToXQMR3fpbrPOmEOewLZeYnIwHGwUCXrQpNQAKCRCwLZeYnIwH G73DAP9mi3rf6wLWGQCMqGMI9NwzaKc1u+2q9ZCYDQziNrbWDgD6A/h7MgSFAloo nbldFhBKQOxO/iC/mMClWFut1ZTyRPw= =xz6R -----END PGP SIGNATURE----- --Apple-Mail=_7E4AA846-4E63-4496-8324-83FC36AC15D6--