Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127848 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 07D9A1A00BC for ; Wed, 2 Jul 2025 19:55:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1751486003; bh=vn6APCnwRqggplieDUau5L1E1yrNq7DvyJVePCwQd/g=; h=Date:From:To:In-Reply-To:References:Subject:From; b=jitcYoUq9ZMPYuFNF4vcjjWSQaGsSVX5BIfGQ7Tx6D7xRCynn4I2vwMsoQ8PPofjq /CH5D6pUOLa2mzdPWDl0/wCCQzJ7/mh+5my1iL/jkfyLkE1TwoI7wKDEBJIFmpB0AF ABeXfYfwdDs5pr84LK/y12f4zSb7CnSD8s399QiN7fRr/P4FoZBL4A8tehzIn+rH+b 6ujxXi1MfrfLMGVSqqJmG8ThniRc3+oaom8WtmalX6hK735lBv2IjRGDOTOH2SE1C8 Y3IX4FJyHd1UEuKSVejXGlximi+S6gi4eCZzDC/XF06IJVcKbjKl7ZY77pvI6fO0Ue xcwvCejwwctUw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3D3E0180082 for ; Wed, 2 Jul 2025 19:53:23 +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-a2-smtp.messagingengine.com (fout-a2-smtp.messagingengine.com [103.168.172.145]) (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 ; Wed, 2 Jul 2025 19:53:23 +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 31AD0EC0476 for ; Wed, 2 Jul 2025 15:55:15 -0400 (EDT) Received: from phl-imap-02 ([10.202.2.81]) by phl-compute-10.internal (MEProxy); Wed, 02 Jul 2025 15:55:15 -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=1751486115; x=1751572515; bh=hrpdYtfo5GEjoUQmTaZu2 P0EEu0xPl0kj2kFzt26Sbs=; b=l902veHQK2ppG//Eg6Hi5P3JCyBUvzwhquA6x XXUachLrvS4xjdFb8/O/7QNSmyZgd4sWlBGxqExMdlEG61h2vEGNn4qcROHyk4cV VzaGzUzQEECqM59zTEpsEoi02Bqu62S0yXs9jNHqVxhpXsd/UsfPt0EJPA632cu4 cVbr+9zNPLbxBgCNfpZOO3brg54aArOCeTIEv5BhYyPXWcu+3JDo3f1QC97QhIXK ItfuzcgSZuo1wsRFDsz+xqDpX/pMcnJyR7XJyg6XJgTNnVxQMJNrrp83otEhPUI+ x7qgoRHiO5wkK29PJsC5w1RUIEBtDxR14KC4Wy87e1DBPEF2w== 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=1751486115; x=1751572515; bh=h rpdYtfo5GEjoUQmTaZu2P0EEu0xPl0kj2kFzt26Sbs=; b=cTL2KsKV/p4kOvt4Q SBx3oPlmvNAncgUR+XW7fC6tozb1Ln3lz/0cGlXgORil2lWntR2MLKPCDX+WNYME ySZ+s8TtpNX+8TUn+PDlAGREEwZh++Ba8rXnkfcBLOh0mEhmN/DU+GecpfYN6j/p YVyIRDW38Uu6qH+X5+/7ShOsjTU8EXmoW6ESkLJXZsPOrwR/z/3rcdFeDu9GTVNL kSz5yLSq7Hx4hv5E+5770V+ryyE+U1vvwqtjCjOMikL373hoTSTxC9oJJdbMMEow D5LbZILHgJ5AXcp2KDrTw9fxr6NkCbMqUwKyHqBWGm9xJDNwYvzBZPszgOHbwbVF o7hKw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgddukedvlecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefoggffhffvkfgjfhfutgfgsehtqhertdertdejnecuhfhrohhmpedfnfgrrhhrhicu ifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomheqne cuggftrfgrthhtvghrnhepffeiiedvhfdvgedutddtgeetieeugeevhfetheeffeeftedu iedthedtgeejueeinecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomheplhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhmpdhnsggprhgtphht thhopedupdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehinhhtvghrnhgrlhhsse hlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id DA089700068; Wed, 2 Jul 2025 15:55:14 -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 14:54:54 -0500 To: "php internals" Message-ID: In-Reply-To: References: <348856E5-6A4E-455A-81AE-882832170168@rwec.co.uk> <38e57171-fc2e-4d79-8614-0b1c5a2efc72@app.fastmail.com> Subject: Re: [PHP-DEV] [RFC][DISCUSSION] Add RFC 4648 compliant data encoding API Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: larry@garfieldtech.com ("Larry Garfield") On Wed, Jul 2, 2025, at 2:25 PM, ignace nyamagana butera wrote: >>=20 >> I don't think it needs to be added to the enum, necessarily. Just ma= ke it a nullable argument to base64_decode. >>=20 >> function base64_decode(string $string, bool $strict =3D false, ?Decod= ingMode =3D null): string|false >>=20 >> That would leave the default behavior of the function intact, but als= o 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 wi= th "disallowed" modes on the new functions. >>=20 > Hi Larry, > > The goal is not to change the signature of the existing `base64_encode= `=20 > function, but rather to preserve its current non-strict behavior withi= n=20 > the new API. This is intended to ensure a smoother transition from the=20 > existing API to the proposed one. Therefore, we shouldn=E2=80=99t alte= r or=20 > retrofit the existing function. Instead, the focus should be on=20 > providing a clear migration path for users, which is why the addition=20 > of a `DecodingMode::Unsafe` case is being proposed. > > If I were to follow your suggestion, I would have proposed an=20 > alternative signature like this: > > ``` > base64_encode(string $string, bool|DecodingMode $strict =3D false); > ``` That would work, too. My point is just trying to avoid DecodingMode::Un= safe as a thing that has to then be checked for and rejected by the new = functions. That feels like clunkiness that we should be able to avoid. = So with that signature, false would still use the existing "unsafe" mod= e; there's no enum case for "old unsafe logic", just for the new-correct= modes. --Larry Garfield