Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129567 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 9DD0F1A00BC for ; Sat, 6 Dec 2025 11:53:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1765022035; bh=mzMiYx/8FThf33Fb8I7Y0dOXIkWQXZXkkAaue25jt/M=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=GYopAOS9BW+6ZNlz90Gs9IpE+BtBh0Q5hrIMXDQpBxGJMFRysw3W+on1wyQrwdYwy YP36xDaMkhmEaRxzIxTzznM75DUdvJxidmmx7NDYFJgBnMS/B+NouywsV7sLLcowmU TCop/wKgEt2j2gt6s1NQ/Xmm7pN5hkI4lh69m+O66hSBDoztgWdf744CjYvg5UH22W iRuzKeFnzmZjBN0K+9L8K4rIq6a2ZJjW8MIK+XU5M5qUQP2sQYqi4Xi/uRtw737l23 YG4P/iUqLYYuy2Wk4X7KaXYfxoqVsH/b9/Qic8ElseHnNSvmq+iNnjbz/tDriYowSA UiC0Q0gdCxvqA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7351F180394 for ; Sat, 6 Dec 2025 11:53:51 +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.1 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,T_SPF_TEMPERROR autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-qv1-f42.google.com (mail-qv1-f42.google.com [209.85.219.42]) (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 ; Sat, 6 Dec 2025 11:53:51 +0000 (UTC) Received: by mail-qv1-f42.google.com with SMTP id 6a1803df08f44-8824ce9812cso28395486d6.0 for ; Sat, 06 Dec 2025 03:53:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765022025; x=1765626825; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=ELtK86o8Q08hH+1jtJ3bNn5L7X6x3l0gjkDh2hXOvr8=; b=CfSwJJLfagXYuOslbbARmiu/3vAZlVc6HE5OveBl8EIUGnKy3CEjRDfwvbXO/UtSrP DB3QtdU5piv9LTlHM/e7WlwBlFtRiwkAuBacFEV7/bh6b6FK8ug+PGikB+PcFBsbMm/k CQlWVwI7Ihm+yyuaGHfZIA835MS2I3eio7yk5tQSPxIk64dql9pnHtgn09ywWg9sf5WD rMUsEuPN9MxyNX0HQ9DwN2BUy0br1m0s+g+8DSGzVvf6VcX6mfnVb6R5Rd6LDlPTiq7G uLoFrCW3gWzkT0+YIQxgvQfxRQRVYDnxnLrHnJXgz2S5ghGpjKUKzKgn5urX9+nwWSYf bXaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765022025; x=1765626825; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ELtK86o8Q08hH+1jtJ3bNn5L7X6x3l0gjkDh2hXOvr8=; b=HUuKXo/LcQjmR2YbN9EqghFCXYKtZ37PM/DFaNY0r0gpsAUxQa/2cgNf7pI4TZbIIQ xkMYDAhda/He5syXQ6ge3OpdauJuoc+NrQjQ2tzxJrC11Sa+g7WdnommU5pXlLbhVctj 7MuFR84MRTfugZEUgGj6sjyYXmVOQCM7SUttvubAIlVlhoczTL/KrHiz1/pz1QOew/2r acIjFnh58r2ZLCT/Y2ED6kiGbHOCHbtnAaRUdVPxuRECBE1HmL6wr9VfgPEn8v9IyHgp SuDdE57b1/2TEqD9K4HLg2zl6nZ5BViGf6rfNS3dkhHLZuWkVFHobLhT8/PMy+sbaHwG oagA== X-Gm-Message-State: AOJu0Yw8jPBwihGNhKUzYsk0mO/aa6ZY5mVLMQkSuYcnjrAFiOGs+S/P lveE1QRDGmvhjvpzjNWViGJG2zQzgEqoa0XCJ3A7JGQKYKFYXablzcaI/t47Wig9kfEtjob+B+o QdrCj81pJMn51VhuE95hOhWE2/xhrytR67Q== X-Gm-Gg: ASbGncvgJ49xzXHI01ZGwpVw/b6VGxNKun8t/NTGn7DbdTB5BITW5GC1vpe6XlgaRXF Y9O2eahHsJCFMcZsidOTuzVpmG2dulaqDmqvAZEkGOpmwCNQZNVS9qGxawRmuwCLpb4i7FsLP1p /raV11yjkJXfqNzlyiz4AgTXuJ7H7aLidjIvqEEp2PKKc5bVeUlvZy3sCqOOprWAAw1+4nGMLLP w77bt81u1rmhJJdi9Ntcl9xC3yTtPpq3gAMdvcY/KKKNVSixpncuBrA8Ok9XGjh7J9Ajg== X-Google-Smtp-Source: AGHT+IFpmIm5sgMNumdQ8tRmHg39rhS/PmYwyfnpCkIib0h7/iWA/JHSYOA0jiCi22IAr/Py5mqOJOyWnu3SuUVZLVQ= X-Received: by 2002:a05:622a:64c:b0:4ed:e40c:872d with SMTP id d75a77b69052e-4f03ff20b52mr30005601cf.59.1765022025481; Sat, 06 Dec 2025 03:53:45 -0800 (PST) Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: In-Reply-To: Date: Sat, 6 Dec 2025 12:53:34 +0100 X-Gm-Features: AWmQ_bn-MTgiZTOyWD-no2Os0oK677PyKMAFyP5EVZ005yzhYsHGPHczc5fYOpo Message-ID: Subject: Re: [PHP-DEV] [RFC] [Discussion] Followup Improvements for ext/uri To: ignace nyamagana butera Cc: PHP Internals List Content-Type: multipart/alternative; boundary="000000000000d980d40645473654" From: kocsismate90@gmail.com (=?UTF-8?B?TcOhdMOpIEtvY3Npcw==?=) --000000000000d980d40645473654 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Ignace, After quickly checking the proposed API for Percent-Encoding and Decoding > Support I wonder if the following would not > be more appropriate ? > > ```php > namespace Uri\Rfc3986 { > enum UriPercentEncoding > { > case UserInfo; > case Host; > case RelativeReferencePath; > case RelativeReferenceFirstPathSegment; > case Path; > case PathSegment; > case Query; > case FormQuery; > case Fragment; > case AllReservedCharacters; > case All; > > public function encode(string $input): string {} > public function decode(string $input): string {} > } > } > ``` > > With the same logic being applied in the `Uri\Whatwg` namespace. This wou= ld make for a better encapsulated feature. So we can > > have a clear distinction between the Value Object, its builder and the En= coding mechanism ? What do you think? > > Yes, I was also wondering whether the URI/URL classes are really the best places for the percentEncode() and percentDecode() methods, because they are not only relevant for URIs/URLs but e.g. also for QueryParams.. So overall, I'm also fine with moving the percent-encoding/decoding capabilities to a separate place. Honestly, the enums themselves didn't come to my mind... I think it's a good candidate. So I'll definitely consider it. Probably my only concern is the name, specifically, the "ing" suffix: it suggests that it can only keep data, and cannot do any operation. The latter would rather have an "er" suffix (e.g. `UriPercentEncoder`). But I'm happy to get feedback/suggestions about the options. M=C3=A1t=C3=A9 > --000000000000d980d40645473654 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Ignace,

After quickly checking the proposed API= for Percent-Encoding and Decoding Support I wonder if the following would = not=C2=A0
be more appropriate ?
``=
`php
namespace Uri\Rfc3986 {
=C2=A0 =C2=A0 enum UriPercentEncoding=C2=A0 =C2=A0 {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 case UserInfo;
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 case Host;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 case Relativ= eReferencePath;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 case RelativeReferenceFirstP= athSegment;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 case Path;
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 case PathSegment;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 case Query;
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 case FormQuery;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = case Fragment;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 case AllReservedCharacters;=C2=A0 =C2=A0 =C2=A0 =C2=A0 case All;

=C2=A0 =C2=A0 =C2=A0 =C2=A0 = public function encode(string $input): string {}
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 public function decode(string $input): string {}
=C2=A0 =C2=A0 }<= br>}
```
With the same logic =
being applied in the `Uri\Whatwg` namespace. This would make for a better e=
ncapsulated feature. So we can
have a clear distinction between the Value Object, its builder and th=
e Encoding mechanism ? What do you think?

Yes, I was also wondering whether the URI/URL= classes are really the best places for the percentEncode() and percentDeco= de() methods, because
they are not only relevant for URIs/URLs bu= t e.g. also for QueryParams.. So overall, I'm also fine with moving the= percent-encoding/decoding
capabilities to a separate place. Hone= stly, the enums themselves=C2=A0didn't come to=C2=A0my=C2=A0mind... I t= hink it's a good candidate. So I'll definitely consider it.

Probably my only concern is the name, specifically, the &= quot;ing" suffix: it suggests that it can only keep data, and cannot d= o any operation. The latter would
rather have an "er" s= uffix (e.g. `UriPercentEncoder`). But I'm happy to get feedback/suggest= ions about the options.

M=C3=A1t=C3=A9
--000000000000d980d40645473654--