Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123825 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 39DB81ADA7E for ; Tue, 25 Jun 2024 16:03:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1719331467; bh=6Jo3Sy22b/MgoXEcIDnPXmKxZO+oqwYmXTWhX8yyhCE=; h=Date:Subject:To:References:From:In-Reply-To:From; b=j8HqSBVtYS9K9YQCPzjtn9bFiBxfxfohx4/J48Tm0GHH4wj3ZoPUhScONkUByGsIL UIxpF45ptYkq2zthrj2FY5oqCA55Zv1DujLg6IeDgDlpLGeu2P9NosCUVXn/3mLrdY xouzvSaJ2oWp4HriEPmYvXxweLzIOZsTLodpO33XgIL/n0b49aDO7a1it4uHP3BQh9 gv64BQQJ24YauncTrlzFBIzurU7sYECHcwp5DyyKaJLb/UlcSuI44vvnxFOqi7CY42 CWOri3KJQsa8rJ5di2vP+JDJUsKckgXMYF1LCIPrp7/SSCWzXDlfKujSzfmjaB/0iw fWG3eYcb1313A== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6C307181040 for ; Tue, 25 Jun 2024 16:04:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from fhigh8-smtp.messagingengine.com (fhigh8-smtp.messagingengine.com [103.168.172.159]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 25 Jun 2024 16:04:22 +0000 (UTC) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 0FA731140227 for ; Tue, 25 Jun 2024 12:03:05 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 25 Jun 2024 12:03:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rwec.co.uk; h=cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1719331385; x=1719417785; bh=GYWfHWG9hJOxMwTS324bKTa0j+fIRlOZFXmB48mQ52w=; b= JLZ/Qre9IiscwaPH/XmEIG807LrHCttOKwjKzRg9fT7NV5V2OFKSGZ+ZqYztDWPh XEOHVzQoPnBLLYP9ahC/H9dK+fQsXOAwLxDq56vlSQf30SEMOP32qx0hHMXCrW0k H6d1T7XsAzt9iYbQ4kQOrING++ARjKXrbPweHYmylfdlIBEeMwRatbE0RK2nJyey 99/ncCjSrSGHbfwUPZuHSZVU4QzQVH2kw7FG+zBX8PoBuJRauKmu4urEymrvWo+Z oln8s9LNqA96Np/rrrIfzXHV5qanr1/lNPZNeuOew0u1X9/Ls2+xFpU0x5Wir9X5 6ewAtPot4lOqLr4cHdIxkg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1719331385; x= 1719417785; bh=GYWfHWG9hJOxMwTS324bKTa0j+fIRlOZFXmB48mQ52w=; b=f IfDJBWEbuOMW/8REUmYXvkq+RfUYVlSakmt8xcXWx3P+vE0YA+cN4HqJs2LqNwn1 IcXbdWNETwBm4MWYl7cVF6Y490OEu1ljI+k0uXGLX6r8OCpM9cuh3gOjFmHT5TH8 2Ov1j5JPEMeUUssKE4NkF9MQHfRcyCoj+AFFxrfz0tGrNrMe2z85SD+VQeOTpr07 wymkvmovVN2GJeCwdjExpKzGZC0Bij2Wd60Cto8K6Sa9VYzGSmDhnMqd2AOqjejl NP7wXZGeeHxcfD4Kz73U9AH1Xis7o/vALeuKqil74UjiQok0bJ1r10ycSIY4lGFe W6tGrA0Z2LzWrteIDtEuQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrtddtgdeifecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepkfffgggfuffvfhfhjggtgfesthekre dttddvjeenucfhrhhomhepfdftohifrghnucfvohhmmhhinhhsucglkffoufhorfgnfdcu oehimhhsohhprdhphhhpsehrfigvtgdrtghordhukheqnecuggftrfgrthhtvghrnhepff ekveduffduvdehjedvfeekleeftddugeefheejudehgeeiudffgeeggeevfeehnecuvehl uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepihhmshhophdrph hhphesrhifvggtrdgtohdruhhk X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Tue, 25 Jun 2024 12:03:04 -0400 (EDT) Message-ID: Date: Tue, 25 Jun 2024 17:03:02 +0100 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] [RFC] Deprecations for PHP 8.4 To: internals@lists.php.net References: Content-Language: en-GB In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: imsop.php@rwec.co.uk ("Rowan Tommins [IMSoP]") On 25/06/2024 16:27, Marco Pivetta wrote: > >  * `uniqid()`, in my case (XKCD 1172) is largely used for quickly > generating a semi-random string for test purposes: a suitable > replacement PRNG implementation would be welcome. Even refactoring > with tools like Rector will lead to quite messy code, or added > dependencies. IMO fine to get rid of **this specific implementation**, > if a safe function is provided, such as `random_ascii_string()` or > such (dunno, just a hint) Agreed, the implementation is weird, but nothing else matches the convenience to just get "some random printable bytes". As of PHP 8.3, we finally have Random\Randomizer::getBytesFromString, but the comparison is pretty stark: $foo = uniqid(); $foo = (new \Random\Randomizer)->getBytesFromString('abcdefghijklmnopqrstuvwxyz0123456789', 13); Alternatively, you have the shorter but slightly cryptic: $foo = bin2hex(random_bytes(6)); Then again, if you _actually_ want it to be unique, rather than random, those aren't the right replacements anyway. I'd love to replace uniqid() with *something*, but I don't think we have that thing yet. -- Rowan Tommins [IMSoP]