Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127841 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 lists.php.net (Postfix) with ESMTPS id 876431A00BC for ; Wed, 2 Jul 2025 16:17:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1751472922; bh=/Y4qfn9VB3w9tpO6a1NoB6D6P4YF9FrEmbBlw9dGiyQ=; h=Date:From:To:In-Reply-To:References:Subject:From; b=cyLCFv5N/iheFOPx8aMibTD8E8BYAf1gV5KT4HEDGpLNFe+mq0WSC95dAwUTvBjb4 r2jctqrw18gai29hnyIMDZ7D0+zZg8W8SMnDsUfbBOewzY0VDvIP8vmg2YHLRI1QHT DrQ6ISI78NqgHy0dYlEX5GGHetsnQUuLhnIqy7XY9C7hn9kRy14OidkJAcmnE1sQ31 wAofYVZRj+bHZ1tQaAYarvlTIBiEh5mS8Nrij3vTek/GHzG/emj72OQFMuon16jLa6 w7KRPcMFApx5DY4iJMeFtr7T4n3DIyouY6vf5Q+NW7bb4Xv8N0E1XnlxsxHM96KsHj ZskROwaFcYRRA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D5322180054 for ; Wed, 2 Jul 2025 16:15:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from fout-a8-smtp.messagingengine.com (fout-a8-smtp.messagingengine.com [103.168.172.151]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 2 Jul 2025 16:15:21 +0000 (UTC) Received: from phl-compute-10.internal (phl-compute-10.phl.internal [10.202.2.50]) by mailfout.phl.internal (Postfix) with ESMTP id 3E221EC0449 for ; Wed, 2 Jul 2025 12:17:14 -0400 (EDT) Received: from phl-imap-02 ([10.202.2.81]) by phl-compute-10.internal (MEProxy); Wed, 02 Jul 2025 12:17:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; 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=1751473034; x=1751559434; bh=mEsEo2NzKFA+aUNqmdpYj 2pqHpGLgrGf4nbvIYtfDeA=; b=V0Spc97E15bx7YFdpINAjdO/cg6idoUgk0ieA GydlnQxGSEgtSTZBz7tzY8I/85HSHI4yZTdKNiJ5meqFQTYCvebaxboj/C/XBDIo s0L7CACGg2TFi76ipzrj/eOwP8gsS8/bqS69+qrStm82ncDXlL7DVRbSPhuyjHZg eTZU/YZ6QJ7JcCfAIeBmO2S3j1+ys/FJosGlO69yVdzStKp5tQX671KuUwNZWLSA o6xsB7XQ/yGpWcam1evp3Go6Pr8geVWL2sKq3IDJzIPnj4gK8KcSR3hlB0JZrcAo vlCjFQYsa1Kd06MShX8Gr5JiG+LKERabjG9AvXLBvm5zPkg0Q== 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-sender :x-me-sender:x-sasl-enc; s=fm2; t=1751473034; x=1751559434; bh=m EsEo2NzKFA+aUNqmdpYj2pqHpGLgrGf4nbvIYtfDeA=; b=EjeFyJ//d1npdBmLr x4TPUNnuKzYgZVlfmboVtRKixMfW5UvyBz1FEoImGmqaHQhnlDnXJrJXK8QjvcCH /+D9JsT+fEnyQitzNhnIFOkOjiWMrL8vag5pi9VkaMbgDFUEnofsDPpCF7FvGxpV GTYIS3QwKCRuV6GdkosAKV3O/FazxuZilhWowSP21bAsVQ73wA7JTJThJ8ZrSCTD lpYIF8lO0rWvQfLAjqwZVOX5Z1SQKwdcr2jSwkF7UACPUEdX/rv7sxOXpCJueFLN b0oC5iFQ3v2iQlPOjTV9j99KpLr599lFdkqY0u7XjHzHDnAHQtfes9gumfE9bqEy L1O9Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgddujeekhecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefoggffhffvkfgjfhfutgfgsehtjeertdertddtnecuhfhrohhmpedfnfgrrhhrhicu ifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomheqne cuggftrfgrthhtvghrnhepueevvdduhffffffhleeuhedvjeevgfelgeetgefftedufeel heegfedvheegleetnecuffhomhgrihhnpehphhhprdhnvghtnecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomheplhgrrhhrhiesghgrrhhfihgvlhgu thgvtghhrdgtohhmpdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdprh gtphhtthhopehinhhtvghrnhgrlhhssehlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id F00FA700065; Wed, 2 Jul 2025 12:17:13 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 X-ThreadId: T1184f03bea8a86d1 Date: Wed, 02 Jul 2025 11:16:53 -0500 To: "php internals" Message-ID: <38e57171-fc2e-4d79-8614-0b1c5a2efc72@app.fastmail.com> In-Reply-To: References: <348856E5-6A4E-455A-81AE-882832170168@rwec.co.uk> Subject: Re: [PHP-DEV] [RFC][DISCUSSION] Add RFC 4648 compliant data encoding API Content-Type: text/plain Content-Transfer-Encoding: 7bit From: larry@garfieldtech.com ("Larry Garfield") On Wed, Jul 2, 2025, at 10:10 AM, ignace nyamagana butera wrote: >> > Perhaps we should include an option in the new API to emulate the old behaviour, named as "legacy" or "unsafe" and immediately soft-deprecated with a note in the manual, similar to the MT_RAND_PHP mode in the Randomizer API > > If I follow your reasoning, this would imply introducing a new case, > `DecodingMode::Unsafe`, in the `DecodingMode` enum. This mode would > replicate the current default behavior of `base64_decode`, but only > within `Encoding\base64_decode`. > > ```php > echo base64_decode('dG9===0bw??'); // returns 'toto' > //would be portable to the new API using the following code > echo Encoding\base64_decode('dG9===0bw??', decodingMode: > Encoding\DecodingMode::Unsafe); // returns 'toto' > ``` > > I would therefore propose that, for all other decoding functions, any > attempt to use `DecodingMode::Unsafe` must result in an > `UnableToDecodeException` being thrown. I don't think it needs to be added to the enum, necessarily. Just make it a nullable argument to base64_decode. function base64_decode(string $string, bool $strict = false, ?DecodingMode = null): string|false That would leave the default behavior of the function intact, but also allows switching it over to either of the new modes (which would then just defer to the new implementations). And we wouldn't need to deal with "disallowed" modes on the new functions. > Should this deprecation take place during the PHP 8 cycle, with removal > targeted for PHP 9? Or would it be more appropriate to defer the > deprecation to the PHP 9 cycle, aiming for removal in PHP 10? > Alternatively, should a second vote be held to determine the > preferred deprecation timeline? Since we don't know when PHP 9 will be yet (Grrr...), I'd lean toward a secondary vote or punting it to the usual mass-deprecation RFC that often happens. (Side note: This is why we need a regular schedule for major releases.) --Larry Garfield