Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114531 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 20093 invoked from network); 20 May 2021 12:36:50 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 20 May 2021 12:36:50 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id BAA0F1804B0 for ; Thu, 20 May 2021 05:46:51 -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,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) (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, 20 May 2021 05:46:51 -0700 (PDT) Received: by mail-ej1-f53.google.com with SMTP id lg14so25050723ejb.9 for ; Thu, 20 May 2021 05:46:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=qy0gFzUx7zwfbpt/97sdy8mpmambm2hYELpjuVZjvU0=; b=ud+5JXKNNxN4Fr6mbOsty3m7xI9vR7hVxCx9JjV/fXjLlKGhe+fbpa2K3VhrhtScHL IsOb53Lr8s1uPoYNlXrF88B+1C91SkFknWZNvNZ7iz7TVSRqmGbbD1hRZ7AtF+rW588F 0jkyy8h8jQGCBliqpFZHGHW/ARuA098300b2vX3wCPA63G2R7xb3nr/9ne0xmoa3oOYM W6Iu5S60oZbua/+i4gmmaIaauMLv8X86dDR53ugccj+FE99arQsvgzhsM5lDKuy5jWzq Ysx3tlyDIMlFU4OhwEKqXOz+q7CtJXcwSMwvws1oqYchPzyi853PwGRpLpAIKKV/pTKk XEpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=qy0gFzUx7zwfbpt/97sdy8mpmambm2hYELpjuVZjvU0=; b=AJLkMFf2jFbGQBtitkqCFvofJUH3CwLH1Ycq5ZiEpfUoHZxhQPWcvMkeNBHHBdgww3 BZUdl6lkbJNzAGJv2Ka3/Od9LPz7pVKmd0tWt2My+JzGtIngpOWWzBFCwF3SPGM11Rzx fTe7SdU9sQ+XVPQUTNNh5Y9bdunY2AXmd9JHe13XHCxI+1aOHX/UGS3Eez2MoJJASRQY 2XIiECJDr3l78bk9/AbVOqJvEG1CakfooEivSGdbBazyHFWnwqsG+KQsqPXXoGDWliK0 ft4lDF8AFCnpfQujoNj1VqceVzpnR67P9vrj1+WRtlb0pg3sFcTNd7Lg8cCQXon2rTbI mJgQ== X-Gm-Message-State: AOAM532pPphpiFJ4uJHhtYSEws4Kr4kgIEPDR2XYSKIKZudeb7RV7EQP I7oUEhs4olQMIuK6A9pwL6F7mmwT8U9rokMc6y0= X-Google-Smtp-Source: ABdhPJzPBTZN2oy0WwSOFZmXO47n7saiANrMW7HqOjGVht4K7SkJfGXYTFTOKS4ONHWj+f6aoFoNQaGE7GoBpMv7Gjw= X-Received: by 2002:a17:906:a285:: with SMTP id i5mr4652599ejz.350.1621514809384; Thu, 20 May 2021 05:46:49 -0700 (PDT) MIME-Version: 1.0 References: <72767cd7-ffc5-c84b-523c-123ff6ef30fa@gmail.com> In-Reply-To: Date: Thu, 20 May 2021 21:46:38 +0900 Message-ID: To: Rowan Tommins , PHP internals Content-Type: multipart/alternative; boundary="00000000000036215d05c2c256a6" Subject: Re: [PHP-DEV] [RFC] [Draft] Add RNG extension and deprecate mt_srand() From: zeriyoshi@gmail.com (Go Kudo) --00000000000036215d05c2c256a6 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thank you. I'm convinced for the most part. I will probably have to separate this into a separate RFC. I'd like to remove the existing reference to `mt_rand()` from this RFC, and not include the BC break. Regards, Go Kudo 2021=E5=B9=B45=E6=9C=8820=E6=97=A5(=E6=9C=A8) 17:46 Rowan Tommins : > On 20/05/2021 05:59, Go Kudo wrote: > > Thanks. > > > > Deprecation will be done only to prevent unintended MT state dependent > > code. We don't plan to go as far as removing the implementation for now= . > > > I think every deprecation notice should mean a plan to remove. If you > just want to encourage people to discover the new functions, I'm not > sure a message in their logs every time mt_srand runs is the right way > to do it. > > > > > Firstly, making these functions independent of mt_srand() is a > > breaking change, so cannot happen until PHP 9.0 at the earliest. > > > > To be honest, I don't understand how far PHP is willing to go to > > accept disruptive changes. > > > The official policy is here: https://wiki.php.net/rfc/releaseprocess It > relies on the phrase "backwards compatibility", which is admittedly > quite hard to define. > > You are right that the change from using rand() to using mt_rand() in > 7.1 is arguably not backwards compatible. However, the following code > can be used to reproducibly shuffle two arrays in any version of PHP: > > srand(123456); > shuffle($array1); > shuffle($array2); > > The exact sequence returned will be different in 7.1 from 7.0, but > because srand() is now an alias of mt_srand(), it still affects the > shuffle() function in the expected way. If we switch shuffle() to an > algorithm that can't be seeded at all, this code will simply stop > working, and have to be completely rewritten. > > A "polyfill" of sorts is possible, by storing an instance of the new > RNG\Randomizer in a global or static variable, but it's more than just a > find-and-replace, especially since many users will need to support > version 8.0 and 8.1 in the same code base. > > As I said previously, I'm not convinced these functions need to stop > using the MT algorithm at all, and certainly see no reason to rush the > change. > > > Regards, > > -- > Rowan Tommins > [IMSoP] > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > > --00000000000036215d05c2c256a6--