Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127859 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 141381A00BC for ; Thu, 3 Jul 2025 14:39:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1751553454; bh=Xi0qnXfMT4bQfHEgb4gyA5iXKcJUotRJzVDthCdKBi0=; h=References:In-Reply-To:From:Date:Subject:To:From; b=TYPwRS02y+byH6BVNgCv/wyQF7WhMS47v5TRNFYysn2hV74em3uX0nUM5juG+OGRA 32AQA7hA1HqtfqDYMPYZqg3A1S4HDNlEjU0eKoMND2wMLE4YaTlyrT3RuEgw8v2P9Q eCgP7sWjwJhAED379yhW1ENN+1qP9keGcYnOE6GstkN3vWXCbuiPRDZ0MsIGPl+9Zx RGGnU09UAKthGQNFFkw3v2zaMWyytLL1+EMpxvdSdB9HH0bMNZ4CaSRRoZeB+OsNBK I4UnYZG928magttg/gRc0z2IL//sJ9dXnkRmPnjUWgi4HKLs2EIvpk1/jEqBgultb7 4/7oVmCbvmwWw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7A3061801E8 for ; Thu, 3 Jul 2025 14:37:33 +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=-0.2 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,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=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 mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.174]) (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 ; Thu, 3 Jul 2025 14:37:33 +0000 (UTC) Received: by mail-pg1-f174.google.com with SMTP id 41be03b00d2f7-b3226307787so4296175a12.1 for ; Thu, 03 Jul 2025 07:39:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1751553564; x=1752158364; darn=lists.php.net; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=8Aj0kxg8oPE7np7uEIlFJqlNRcUAM6D6GygIzHSRVjw=; b=PSVEtjsjDJU9xFfMDNHLS9JGSC9bimrjvz6rlRvx9oc1Kz0A15B6vLnYOMfzHQ9fiO zdvpnkXsR3UO7Bb8SwZJHsFKNqZRazD0ABqMvP4ihLnOL6SIUExgGiJ8z+0ydo140bnf DAehQJVmzU58VHV1wAgU5byDgSvSw8FIAvHZu+qBLV9H74AsRjq8AYyCsRjncWuhTdTe 9sIxTzvq6xSKx/J7zmsRwoDS/wb/kGRN1nJP8F+5WWcc63P4Ys2nOHnLripvM6pCOzAF 8+jWz1wd/Uf0Ftd4jJRf7vxjy7bUhkRHxmIo6ON+pcXUeNE7+NrzI9Bs9QQguZf6x7nw gZ/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751553564; x=1752158364; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=8Aj0kxg8oPE7np7uEIlFJqlNRcUAM6D6GygIzHSRVjw=; b=pMetiq9fDGZMoHhtuu/3xXPncSYGlR1+mwmgUWBQe0mLqOKCUCgxccaeX8hwCRX8ZL hmE/yWfqJjX5l1d2VGfGRFyLtNkKZB1RtSK20+H3G/v9NwCdv76tZGuN6zme2shY4Uc7 3om5DHTa0obqiXEi6FwBWmMx+ADOV/keV0gfoLwmjMOdHM5CLEq6djcSDAu5zmmF+BhX HlKr4aV+2/bB24T3Ou96/7RYb0PRHmabnfqrQH4JHhX2h7F/P/GyefBrsZuNkaGflnIP 2hjXII9quJv87wUxJ/Ic5zlaYa2yo2Uqf2RPBGqhIurhtj6wuQsuwBO+UEUg4GsfC/qQ XUjw== X-Gm-Message-State: AOJu0Yyk9iinh8KJMhNliDmTZxd84j2bjrtTDraisVTMBjF6YUta2YwS rJmkOa7snXkRVqrvniXL7NOwSoSlsnO7K0Vik9wGUXaCe1bPQvM/8qWa3wn2ZXNZ9QXgmH4NVwk 14kx4OacOz2LJ/2fqhaU6cNaowoyLYWlkA4KY X-Gm-Gg: ASbGncu0ejTtDikLGQqRodKyDlVlKqtqFB2UZAl670XRm+rp8AekzepdIL9YB04RYEx l3jPZbSLVUYyT7P46+nGvIguji68+RQ1ByNNLz+tVUbtbDD3Kpi+EZ0MZ4ce/Z2BP1a6f6lwhnI k+PoRhnCoqus0xCcjanueVKGSkjS3zZWJve0GsI4CbkDgRWfMIKNAd3w== X-Google-Smtp-Source: AGHT+IFVDu4XV4by4w3xTn+nJSwZ/QswGz4TSguQ+mm1KuXtv8aVo+zrpZQ7mC2B+Xtg2ipy5FGb21wDReUDb9m3Dv0= X-Received: by 2002:a17:90b:1d4e:b0:311:ba32:164f with SMTP id 98e67ed59e1d1-31a90b368bdmr9496121a91.8.1751553564105; Thu, 03 Jul 2025 07:39:24 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: <348856E5-6A4E-455A-81AE-882832170168@rwec.co.uk> <38e57171-fc2e-4d79-8614-0b1c5a2efc72@app.fastmail.com> In-Reply-To: Date: Thu, 3 Jul 2025 16:39:12 +0200 X-Gm-Features: Ac12FXzou3G7u7_e4_2qDpjuyy-QPrl-k0CHZUQRr_JJa_Dx1W8ygYu46qptJkQ Message-ID: Subject: Re: [PHP-DEV] [RFC][DISCUSSION] Add RFC 4648 compliant data encoding API To: PHP Internals List Content-Type: multipart/alternative; boundary="000000000000fe5ef00639075735" From: nyamsprod@gmail.com (ignace nyamagana butera) --000000000000fe5ef00639075735 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi all, I have updated the RFC to include a section outlining the migration path . Since the proposed migration strategy for base64_decode() *may be considered controversial*, I plan to submit it as an *optional vote*=E2=80=94allowing contributors to decide specifically on that aspect. If the optional vote fails, I want to ensure that the rest of the proposal is *not rejected* solely due to disagreements over the migration approach for this function. Best regards, Ignace On Wed, Jul 2, 2025 at 9:57=E2=80=AFPM Larry Garfield wrote: > On Wed, Jul 2, 2025, at 2:25 PM, ignace nyamagana butera wrote: > >> > >> I don't think it needs to be added to the enum, necessarily. Just mak= e > it a nullable argument to base64_decode. > >> > >> function base64_decode(string $string, bool $strict =3D false, > ?DecodingMode =3D 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 jus= t > defer to the new implementations). And we wouldn't need to deal with > "disallowed" modes on the new functions. > >> > > Hi Larry, > > > > The goal is not to change the signature of the existing `base64_encode` > > function, but rather to preserve its current non-strict behavior within > > the new API. This is intended to ensure a smoother transition from the > > existing API to the proposed one. Therefore, we shouldn=E2=80=99t alter= or > > retrofit the existing function. Instead, the focus should be on > > providing a clear migration path for users, which is why the addition > > of a `DecodingMode::Unsafe` case is being proposed. > > > > If I were to follow your suggestion, I would have proposed an > > 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::Unsafe 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" mode; there's no enum case for "old unsafe logic", just > for the new-correct modes. > > --Larry Garfield > --000000000000fe5ef00639075735 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi all,

I have update= d the RFC to include a section outlining the migration path. Since the propo= sed migration strategy for base64_decode() may be cons= idered controversial, I plan to submit it as an optional v= ote=E2=80=94allowing contributors to decide specifically on that a= spect. If the optional vote fails, I want to ensure that the rest of the pr= oposal is not rejected solely due to disagreements over th= e migration approach for this function.

Best regar= ds,
Ignace

On Wed, Jul 2, 2025 at 9:57= =E2=80=AFPM Larry Garfield <la= rry@garfieldtech.com> wrote:
On Wed, Jul 2, 2025, at 2:25 PM, ignace nyamagana buter= a wrote:
>>
>> I don't think it needs to be added to the enum, necessarily.= =C2=A0 Just make it a nullable argument to base64_decode.
>>
>> function base64_decode(string $string, bool $strict =3D false, ?De= codingMode =3D 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).=C2=A0 And we wouldn't need to d= eal with "disallowed" modes on the new functions.
>>
> Hi Larry,
>
> The goal is not to change the signature of the existing `base64_encode= `
> function, but rather to preserve its current non-strict behavior withi= n
> the new API. This is intended to ensure a smoother transition from the=
> existing API to the proposed one. Therefore, we shouldn=E2=80=99t alte= r or
> retrofit the existing function. Instead, the focus should be on
> providing a clear migration path for users, which is why the addition =
> of a `DecodingMode::Unsafe` case is being proposed.
>
> If I were to follow your suggestion, I would have proposed an
> alternative signature like this:
>
> ```
> base64_encode(string $string, bool|DecodingMode $strict =3D false); > ```

That would work, too.=C2=A0 My point is just trying to avoid DecodingMode::= Unsafe as a thing that has to then be checked for and rejected by the new f= unctions.=C2=A0 That feels like clunkiness that we should be able to avoid.= =C2=A0 So with that signature, false would still use the existing "uns= afe" mode; there's no enum case for "old unsafe logic", = just for the new-correct modes.

--Larry Garfield
--000000000000fe5ef00639075735--