Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129606 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 755581A00BC for ; Sat, 13 Dec 2025 21:48:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1765662533; bh=FAHMcB6VephYe2EmRX3DV+tvN+lI7cCcWPy5TIh3MWA=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=LQVuN+u6zt631LX6OjFSN4pk97L6T3kkX2RTBSnklJ7Vrw61O7R0jMrGDZOs8f3L6 bnSNIaLzaAfux0DOVov24l3BNxspcizvFhwLkuag+2cCuv9J++2+NoHcfS/WB/jUvW /2xOQWGrHbP7oXBnnHTt+JsABQnLhyJKpetgmuXk0pWLGeVKs6RZTGQQrGiuaSOWi5 HurUjYBVJFd9dtkhgt8DsvKMwCePg6pf9BM1v9R/9n2joIaKE/yGakA2FhiqCriHDU qdb7tbAfFy3XRyMc7ePVYP3JW3izIHPCMMdb44V1Jjsr5xNYbvk/EdeFYfyU/vI5Nm 7Pp5oFNmUQ2JQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3880618003E for ; Sat, 13 Dec 2025 21:48:52 +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.9 required=5.0 tests=BAYES_50,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,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-qv1-f44.google.com (mail-qv1-f44.google.com [209.85.219.44]) (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, 13 Dec 2025 21:48:51 +0000 (UTC) Received: by mail-qv1-f44.google.com with SMTP id 6a1803df08f44-8888a1c50e8so14320726d6.0 for ; Sat, 13 Dec 2025 13:48:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765662526; x=1766267326; 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=FAHMcB6VephYe2EmRX3DV+tvN+lI7cCcWPy5TIh3MWA=; b=gPW1/CLF3fw8yvipm9n0h/ApTuMc313j3xddrGIvBksCfSUw3LXqTr8SGxCtI152RN 63h4rn4pFt8wk9Hy7lhhpxwgS62AuZmvyiBa59js3ACIfACfuJW2OQZfLLCZi0iOvGMO 6lukHMpBeGOi2YTqRbh6PKY0MclOarjlZ/M8DKqOIeZNMabaaSOadLegvJbuKuIEBmGp ySvdDkH54rUIEW8xA8c48Eo2kYLI0do26nmKXpfpafCX2uXtPAkZraaCjaGWlDYBbdKG MFkI9NQKWMZ1oS1Y/Yk8HuUkeOt5XIFN7sH389t8faiVLOeccVF7EPRQVKCaBA9GXn0o YeXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765662526; x=1766267326; 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=FAHMcB6VephYe2EmRX3DV+tvN+lI7cCcWPy5TIh3MWA=; b=IBJSDs9GWGdfqfeYNJXTxgME5aRc1wRxqK8XWPFkxQgEKaG6t5FAo1Jn5GXrahb3Id oDLsnXNdH75UmoTP6pvmlcbBvFw6VosMDl9zivEEFxSeZWcQ01UNjt84tW4MO79AEuPT /EHDsivjNuimHBq8oOX6PMALRZRmQwRoWadq/JwnIFfL0XmGg//HVwMu+u0lmjRiHRg2 s8fEEVidc/Ef0Tr/LUif0uxBw6qteoazAr4JHnx10G18EszhrwEdZpI8/PiJAWXckTNu /1VD9E3dYc5sQLdKxcnOGGwKsuIIYdDrIrOuzTPUwNEWgWlM6Jf+F/TLVf8Kw+8lAj1A Ugsg== X-Gm-Message-State: AOJu0YwaOwwzIl8CZmKpL9LH6gdKogb8cqYGQ6p487rJ/+v8cE96ETBk DyV5PMepyJvfwckNTEqJdtfX1/SlRZhs4HJborwMg2x7i+9yp5yExclJVcb0OuRSEGP5VXephvm RkpF0E0d0c6jhQ+LhRuPx+q9nna56DjaDRttD X-Gm-Gg: AY/fxX48LO7hr/fLM2fNQOXhf4I4s/ZtoIG0n2Yjju79j/Us71Ga6LN0YgpcDMc3hqu /t25iokGweyMXVtMLP3XgcCv4hFXU+3uD1tKzK57eIqv/0/RF6bDVXYUQWSXyjkVvxnUIXPRol6 GrcwyRjwDAf/XAR+aCMfOeibKqnM3wU11C9clvGcK5Wp+/0/ICdhkVeZE64EQDCoeCMgMmHLlEE 7NJxFtoYksQdhalgcgKUxXQQDCnnyWXjnuQ6s4pW9qLS05xnK25V8jvxYdNtT6+frN6Vg== X-Google-Smtp-Source: AGHT+IEL0rcRQh9FDEW0qgbc82RahcHEOKOtWA3WD2oJw8wNIiBrlH7E8AGbfTk/xPNNJFzdVRGWNqBXgr+O68Oy+00= X-Received: by 2002:a05:622a:2612:b0:4e8:a6f8:e3c1 with SMTP id d75a77b69052e-4f1d04a48dfmr84290221cf.18.1765662525890; Sat, 13 Dec 2025 13:48:45 -0800 (PST) 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> In-Reply-To: <83238ad3-c844-4457-dfb3-11321787e022@php.net> Date: Sat, 13 Dec 2025 22:48:34 +0100 X-Gm-Features: AQt7F2r9NtNglVkfJRNYCZuuMKHF-FlJu0StzlWXMJGDHrqE3FSqX_51v-dMlZM Message-ID: Subject: Re: [PHP-DEV] [RFC] [Discussion] Followup Improvements for ext/uri To: Derick Rethans Cc: PHP Internals List Content-Type: multipart/alternative; boundary="000000000000a622070645dc57a8" From: kocsismate90@gmail.com (=?UTF-8?B?TcOhdMOpIEtvY3Npcw==?=) --000000000000a622070645dc57a8 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Derick, > Would it make sense to have an interface for the set*() methods? Besides > build(), they all seem to have the same API. > I've just answered this to Juris, but TLDR: IMO it is not possible if we go with the currently suggested behavior. The set*() method pairs would have completely different validation rules based on the specification they implement. > > - Query Parameter Manipulation > > I see this adds NoDiscard: > #[\NoDiscard(message: "as Uri\Rfc3986\Uri::withQueryParams() does not > modify the object itself")] > > But the original methods on the classes don't have these NoDiscards, and > it doesn't seem that this RFC is suggesting to add them. It should at > least be consistent. > Thanks for noticing these; I wanted to add #[NoDiscard] to Uri/Url wither methods just before the final PHP 8.5 release, but it was a bit controversial, so I didn't do it at last. Then I thought that at least the newly proposed methods could have it, that's why I included these attributes into this RFC. But now I realized that I'm not ready to fight for them, so I've just removed them all from the proposal. > > - Accessing Path Segments as an Array > > Compare: > > "especially considering the fact that Uri\Rfc3986\Uri internally stores > the path as a list of segments." > > And: > > Uri\Rfc3986\Uri::withPathSegments() =E2=80=A6 internally concatenate the = input > segments separated by a / character, and then trigger > Uri\Rfc3986\Uri::withPath() =E2=80=A6 > > Why does it need to do this concattenation, and then call withPath() for > Rfc3986\Uri then? > The path setter of the uriparser library (uriSetPathMmA) takes a string first, then reparses it as an URI (setters for the other components work much simpler), and finally, does a few other checks/modifications. If everything went well= , the path is stored as a list of segments indeed. That's why concatenating the segments is needed, otherwise validation wouldn't work properly. Cheers, M=C3=A1t=C3=A9 --000000000000a622070645dc57a8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Derick,
=C2=A0
Would it make sense to have an interface for the set*() methods? Besides build(), they all seem to have the same API.

I've just answered this to Juris, but TLDR: IMO it is not possibl= e if we go with the currently suggested behavior.
The set*() meth= od pairs would have completely different validation rules based on the spec= ification they=C2=A0implement.
=C2=A0
> - Query Parameter Manipulation

I see this adds NoDiscard:
#[\NoDiscard(message: "as Uri\Rfc3986\Uri::withQueryParams() does not = modify the object itself")]

But the original methods on the classes don't have these NoDiscards, an= d
it doesn't seem that this RFC is suggesting to add them. It should at <= br> least be consistent.

Thanks for noticin= g these; I wanted to add #[NoDiscard] to Uri/Url wither methods just before= the final PHP 8.5 release,
but it was a bit controversial,=C2=A0= so I didn't do=C2=A0it at last. Then I thought that at least the newly = proposed methods could
have it, that's why I included these a= ttributes into this RFC. But now I realized that I'm not ready to fight= for them,
so I've just removed them all from the proposal.
=C2=A0
> - Accessing Path Segments as an Array

Compare:

"especially considering the fact that Uri\Rfc3986\Uri internally store= s
the path as a list of segments."

And:

Uri\Rfc3986\Uri::withPathSegments() =E2=80=A6 internally concatenate the in= put
segments separated by a / character, and then trigger
Uri\Rfc3986\Uri::withPath() =E2=80=A6

Why does it need to do this concattenation, and then call withPath() for Rfc3986\Uri then?

The path setter of th= e uriparser library (uriSetPathMmA) takes a string first,
then re= parses=C2=A0it as an URI (setters for the other components work much simple= r),
and finally, does a=C2=A0few other checks/modifications. If e= verything went well,
the path is stored as a list of segments ind= eed. That's why concatenating the
segments is needed, otherwi= se validation wouldn't work properly.

Cheers,<= br>M=C3=A1t=C3=A9
--000000000000a622070645dc57a8--