Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130654 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 7A3661A00BC for ; Wed, 15 Apr 2026 22:22:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1776291737; bh=Xo22tKUzFdUeRHWZQ06hxXHHWBdp5GUlTUfpi/OcAd4=; h=References:In-Reply-To:From:Date:Subject:To:From; b=GX8x3YhHyd8hktBWZ5xMKq0QTvs/1fPecYOgw7ESxTX41N0vQvtpzEkE+CTYcinAr zfb37odrDXRKQY1wPHtzB0DeVKXGZvQXjWMBCll1c/8nOT3+HMWkXIZUPoVbb0EHyB 99SAS1QwR8KHNjC9Qn8g+rR2Abp0FQiu1PvIg2NTX+zcsL1Q07hTYJlRp6RqSXS+Xk GArVZ4tFuUvyjzu7dwDI5X4I3ehu7QNM2R4CN6R7FIwvAd6uQ0mE6KAFjFoh5SmlVt HwK7qxrJATZW7SgnxDLJDx1cxEy5/RV89VcbbbGQMZUPtErTuL46PRwSTPm9azTqIM qRWIoh2Ol9NPg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id F21ED1801DB for ; Wed, 15 Apr 2026 22:22:16 +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.6 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_50, 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: No X-Envelope-From: Received: from mail-ot1-f43.google.com (mail-ot1-f43.google.com [209.85.210.43]) (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, 15 Apr 2026 22:22:13 +0000 (UTC) Received: by mail-ot1-f43.google.com with SMTP id 46e09a7af769-7dbb6c072f1so6687240a34.2 for ; Wed, 15 Apr 2026 15:22:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1776291728; cv=none; d=google.com; s=arc-20240605; b=dIsywvhUqjfUOqqejIDMSn4c+wHG33Bdo3JRZWgb3Xayom5t1VCE/i+rJtN6YsA5o6 iphJMqqt7WDge6vIgBtZKK0VLM4ubaSDpQiHR3RPlFS0b5l7jhhXv+lE5k136l8dFOa+ RFrqwxftKiSElq4KrbxKrc489ZgLWLUHt1u/Haiejo4WsgItVGPCh2gMonj3+1rCITBJ HfBULQ7kkuPTmwDLINEanFCAIiTtQVextYfh5RaaZayE/D+CANVKlZK7Ivp3+a5G9R/y spOypFSBTpj1JCx7Q+Cd0CFyBow/TzQ7jsFz0yaF1BWDcb+Ucoxg25oDJKzJutXkklfv GEDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=KT+tU7sZdGwR8k5UJQKlVklPgByw4jm2Xjv/YVgj8eA=; fh=2CXdihC54YFwKzt8jLnUZOSeEDlRCQTtPqBH62MKM2s=; b=Wyw3+u8vdGq9XmhuaRtvcbhgQ4uoayc9XGCPXz+tRvDjtyoCEvl+st8N+Jsz2YKDhm CPCjlYPkHZVr+bxEqTi7LPzXXTRNGv903l8yMZ2k+vN4uKrcZltb0UTpqmqTI8IfZfDm j6sze0P+p16rbd70RcCOurvujHgHDi7v3tUe7x4Fmb8jJbxulELO/FrMRbQ0v1mW1FJ3 Txw2knzQKIC6zQFZ5+xVbfuKUnJzNcNOGESb/8vVB9hq66bKjeHpel/h85nSAN4EJ5Gf mfRFxvvF6IfZJ+PPvkti75CbgKYTgCIrVjBGaK8LKnwCleGb0M1KakdNSJiShbfLyEKo pvRA==; darn=lists.php.net ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776291728; x=1776896528; 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=KT+tU7sZdGwR8k5UJQKlVklPgByw4jm2Xjv/YVgj8eA=; b=k7X2+630xZpAumhxI7fvz0sivX8G87f4q2mfZbtcI3jT8q6OzZUbr0oEJs7j+H3TjS N9dL/GEHbLKV/RMIHCWL81KNBkpBncN5bD/wXjdQd0mi29Z7sK1Lisl6WzXhdkUFwfne tyeeYOOHG4T+RdHpSJcPOSJmZvX5PmdW0HymWGsAxbTeRTXNErvGUUY2ztSA3EQVpE3N +zuVM8L63nIqGmNvRi2WyOBzoYNMrcQEktlWqjOJ2JK+ySNmeic/9+PhLkcwkPfnRixm 17iYFuSNG5RVce4gX/CxQcxvVM14nJo25NFLM9mlpJ9LqP6ph/WdIiMk+Soi5viUOx1B 82FQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776291728; x=1776896528; h=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=KT+tU7sZdGwR8k5UJQKlVklPgByw4jm2Xjv/YVgj8eA=; b=f4Qqq+6jN0L4uBVzL24KYmcJz3GHMhSSfVg0I85YQOYo4UGaSA7i+ciD41qMsiREr6 ZvZtC12s/Kfn5hwKidF4U6t+5+ivIjLEobO9vJGVToqtICt/IqUMBi0JbcSu9deCq0UZ Znmbtrr41QUpCC8YoeIoDUtTj2oJ8YNxS3cJPfhW2iTUA4LCZX6yBQLHwYqHoq/IueUw 2xqwB8rvToDrfdS/8rUGNJlV6lcXrHCXcDYLMFyTSDunHx6xe5QjRuS8SLzvUSczzEG7 w8P02gsTODEeb3OAm9nacl3HYqtnNmLqWC0Fy8LqE1/d4PztOrO7w86TcvuXvAmy2fQP IgWg== X-Forwarded-Encrypted: i=1; AFNElJ9RwRpz/NnTlpvveNR/szGtbztjtCcRH5B74dX0XpvKOGBG/6aHE7KaF9F/JyWKzvv2pFXuasOEXBA=@lists.php.net X-Gm-Message-State: AOJu0YxlYssQZfcE/DLd0FTxqAmNXMDU8rGmXzaoX9mkcxhY01horAm5 8a+Uu7jgDdF5+qqSycH5BOQR1oPPTuQd96SfNNr/Ukb/xmYCOCTUhnsRoG06tYphalGD+cBHGny rHhu+HxZfK/ZBKE0PCXrdD5osm4uHDeI= X-Gm-Gg: AeBDievA9Gty/Pej5a2ALrTdnDXUN3cPURA+e8EDgjS6hM9jZq1QjlSqTWdJf7baraf EGPd7B8QygEbe/1/NjfkRZrgeZmDVkkqnbPodF6sltmpI6D2xzYx3eZC7x0hNnNv9knXv9GMtcK V9DePXfQI4rHtWjfWE6SHcXyjLx2GKPOkB8luoD+u9Wb5vCXAebY/rKBgmQrwMpEoPPZjte/Zgx QSd9FMOPBiCy/Ml7gKMYM6DRGc4bZmEG4KPpjydcKWTMmYlqfuYl1yV/1uDlFIlxEH3shcJVQ0x 8ZpgMg6fbOXkc9jcAkkK2hZ02XShK1m1Jg0H0c07DQ== X-Received: by 2002:a05:6820:670b:b0:67e:4189:806 with SMTP id 006d021491bc7-68be90cefcbmr9297672eaf.64.1776291727984; Wed, 15 Apr 2026 15:22:07 -0700 (PDT) Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: <83238ad3-c844-4457-dfb3-11321787e022@php.net> <4643495923b044673383e38c68beca73@bastelstu.be> In-Reply-To: <4643495923b044673383e38c68beca73@bastelstu.be> Date: Thu, 16 Apr 2026 00:21:56 +0200 X-Gm-Features: AQROBzDMa1rpGs87F0hC60mMiib5Sk4Ztg8RKojD4-wKfkfie9bNeaGBnkvpmqw Message-ID: Subject: Re: [PHP-DEV] [RFC] [Discussion] Followup Improvements for ext/uri To: =?UTF-8?Q?Tim_D=C3=BCsterhus?= , =?UTF-8?B?TcOhdMOpIEtvY3Npcw==?= , Larry Garfield , PHP Internals List Content-Type: multipart/alternative; boundary="00000000000076ca47064f872563" From: nyamsprod@gmail.com (ignace nyamagana butera) --00000000000076ca47064f872563 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable As far as I am concerned, this brings me back to my earlier suggestion (with a Polyfill implementation). The name can be changed or improved but I did go with an Enum and two public methods encode/decode see https://github.com/thephpleague/uri-src/pull/186 which to me sounded like: - a better DX. which avoid polluting the Uri(l) classes - allow for an easier transition with an additional polyfill - properly decouple the Encoding feature from the URI parsing ones. so am I +1 on this change that I have already expressed which is my biggest concern over the current RFC proposal On Wed, Apr 15, 2026 at 10:23=E2=80=AFPM Tim D=C3=BCsterhus wrote: > Hi > > Am 2026-04-15 22:04, schrieb Larry Garfield: > > For host type detection, what does a null return signify? UrlHostType > > includes an Empty case, which I'd assume would be used in that > > situation. And I'd rather have an Empty case on UriHostType as well > > rather than null, unless someone can make a good argument for using > > null instead... > > An empty host is semantically different from a missing host. > > You can check that with the existing functionality in PHP 8.5, where > `getHost()` is `?string` for both RFC 3986 and WHATWG URL in accordance > with the respective standards. If `getHostType()` will return `null` if > `getHost()` returns `null`. The cases of the Ur[il]HostType enums in the > featured RFC are also pulled straight from the respective > specifications. > > > LeadingSlashPolicy::AddForNonEmtpyRelative is... a mouthful. > > Self-documenting is fine, but as the example demonstrates it quickly > > creates super long lines. That could be a problem in, say, a match() > > statement, inside a method, where with that enum value as a case you'd > > be more than halfway across the screen before you get to the executable > > code for that case. Is there no way to make that whole thing shorter? > > FYI: I've also had little time for this RFC, but I've started discussing > spinning off the =E2=80=9Cpath segment=E2=80=9D part of the RFC into a de= dicated RFC > with Mate off-list a few days ago, similarly to how the query parameters > part has been spun off because it has become too complicated for a bulk > RFC. > > > I'm not sure how I feel about object methods on the enum. That would > > be something like: > > > > use Uri\Rfc3986\PercentEncoder; > > > > PercentEncoder::Path->encode($someval); > > > > Right? [=E2=80=A6] > > Yes. > > > use Uri\Rfc3986\encode; > > > > encode($someval, PercentEncoder::Path); > > > > Is about the same length, and with PFA easily pre-configurable, and > > closer to what is typically seen in the wild today. > > FWIW: The enum would also be =E2=80=9Cpre-configurable=E2=80=9D with > https://wiki.php.net/rfc/partial_function_application_this. Arnaud and I > are working on a more general version of that RFC based on Bob's > feedback, but will need to figure out the latest edge cases before > proposing it. > > Best regards > Tim D=C3=BCsterhus > --00000000000076ca47064f872563 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
As far as I am concerned, this brings me back to my earlie= r suggestion (with a Polyfill implementation). The name can be changed or i= mproved but I did go
with an Enum and two public methods encode/decode = see https://gi= thub.com/thephpleague/uri-src/pull/186 which to me sounded like:
<= div>
-=C2=A0 a better DX. which avoid polluting the Uri(l) cl= asses
- allow for an easier transition with an additional=C2=A0po= lyfill
- properly decouple the Encoding feature from the URI pars= ing ones.

so am I=C2=A0+1 on this change that I ha= ve already expressed which is my biggest concern over the current RFC propo= sal

On Wed, Apr 15, 2026 at 10:23=E2=80=AFPM Tim= D=C3=BCsterhus <tim@bastelstu.be> wrote:
Hi<= br>
Am 2026-04-15 22:04, schrieb Larry Garfield:
> For host type detection, what does a null return signify?=C2=A0 UrlHos= tType
> includes an Empty case, which I'd assume would be used in that > situation.=C2=A0 And I'd rather have an Empty case on UriHostType = as well
> rather than null, unless someone can make a good argument for using > null instead...

An empty host is semantically different from a missing host.

You can check that with the existing functionality in PHP 8.5, where
`getHost()` is `?string` for both RFC 3986 and WHATWG URL in accordance with the respective standards. If `getHostType()` will return `null` if `getHost()` returns `null`. The cases of the Ur[il]HostType enums in the featured RFC are also pulled straight from the respective
specifications.

> LeadingSlashPolicy::AddForNonEmtpyRelative is... a mouthful.=C2=A0 > Self-documenting is fine, but as the example demonstrates it quickly <= br> > creates super long lines.=C2=A0 That could be a problem in, say, a mat= ch()
> statement, inside a method, where with that enum value as a case you&#= 39;d
> be more than halfway across the screen before you get to the executabl= e
> code for that case.=C2=A0 Is there no way to make that whole thing sho= rter?

FYI: I've also had little time for this RFC, but I've started discu= ssing
spinning off the =E2=80=9Cpath segment=E2=80=9D part of the RFC into a dedi= cated RFC
with Mate off-list a few days ago, similarly to how the query parameters part has been spun off because it has become too complicated for a bulk RFC.

> I'm not sure how I feel about object methods on the enum.=C2=A0 Th= at would
> be something like:
>
> use Uri\Rfc3986\PercentEncoder;
>
> PercentEncoder::Path->encode($someval);
>
> Right? [=E2=80=A6]

Yes.

> use Uri\Rfc3986\encode;
>
> encode($someval, PercentEncoder::Path);
>
> Is about the same length, and with PFA easily pre-configurable, and > closer to what is typically seen in the wild today.

FWIW: The enum would also be =E2=80=9Cpre-configurable=E2=80=9D with
https://wiki.php.net/rfc/partial_function= _application_this. Arnaud and I
are working on a more general version of that RFC based on Bob's
feedback, but will need to figure out the latest edge cases before
proposing it.

Best regards
Tim D=C3=BCsterhus
--00000000000076ca47064f872563--