Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120183 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 81650 invoked from network); 2 May 2023 17:05:48 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 2 May 2023 17:05:48 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 53E841804DF for ; Tue, 2 May 2023 10:05:46 -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,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS24940 176.9.0.0/16 X-Spam-Virus: No X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 2 May 2023 10:05:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1683047144; bh=TdSnToB5gRQ2N87sBoGha2dpvEmGEFg8oCsnRQWvjpY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type:from:to:cc:subject:message-id; b=oSpeSBvo5xg/K/OwsD2vLsuJFoTmPNNMuj0CrY2LaoxxE14zdGmrWHuZ45ddWlNc/ A3xj1oeNjzi4TK7IYimohGUQ/RvnOmczgOHtHPGfo6dLrd4Ls9cY//REeafLDqFbjY ml6N8/3iDdkcjOkF4MEMN0+iSp4TxCl2hB9szemwrp+t4rOE0+4Fw1ufMXQAXy+XfM a4VRb2pjsSBbOKvmCkbp8Ho1HvMQ0OFV7ZJa19oCUuBoCN61bOFYKGwwDu2gU+mum+ C6XAF9cXYl9yaMkiaR0QHIuatHvtbuELCoZVFlZ8/8OVGrNUoEHPM5rDi/v7mmiwmQ IoyOxwT2Bv22Q== Message-ID: <6cab1982-3323-25c4-b670-95798b176b09@bastelstu.be> Date: Tue, 2 May 2023 19:05:43 +0200 MIME-Version: 1.0 Content-Language: en-US To: Dan Ackroyd , =?UTF-8?B?TcOhdMOpIEtvY3Npcw==?= Cc: Kamil Tekiela , PHP Internals List References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] [RFC] [Discussion] Deprecate functions with overloaded signatures From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=c3=bcsterhus?=) Hi On 5/2/23 13:37, Dan Ackroyd wrote: > For the functions that are having new separate methods added, not > deprecating them immediately makes upgrading easier. When upgrading > from one version of PHP to the next, it is best if you can run the > same code on both versions, without any deprecation notices going off. Agree here, I consider it a good thing if there's at least one version where both alternatives exist and are fully supported (i.e. without emitting a deprecation notice). As an example, with PHP 8.3's addition of Randomizer::getFloat() and Randomizer::getBytesFromString() there are useful replacements for lcg_value() and uniqid() [1] respectively, but I'm intentionally not proposing deprecating either of them before whatever comes after PHP 8.3. [1] The latter of which is likely one of the most misused functions in PHP. > Would leaving the current versions in place and working actually cause > any maintenance issues? > > If not, then we could just move really slowly on deprecating them. We > could deprecate them at some point in the 9.x release cycle and remove > them in 10.0. Does it necessarily follow that a function that is deprecated in major X must be removed in major X+1? Otherwise deprecating with 8.3 and removing in 10 would be an option that could be evaluated when it's time for 9 and the migration did not yet "sufficiently" happen in userland code. I can also see how that would be useful for the planned deprecation of rand() and mt_rand(). Both of them have overloaded signatures, but will be part of the other deprecation RFC, as they also have a myriad of other issues that I consider to be worse than the signature. Unfortunately they are pretty ubiquitous, but luckily do not cause "internal" maintenance problems. So it would likely be feasible to keep them until 10, as long as they emit the deprecation notice to slowly nag developers away from them towards better alternatives. Best regards Tim Düsterhus