Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129493 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 561E61A00BD for ; Mon, 1 Dec 2025 22:19:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1764627555; bh=8pv6+WC/bXkcLRGWkWQiYoUTQvwgjUGsoLQSEkvCdGI=; h=Date:From:To:In-Reply-To:References:Subject:From; b=L6j5/fmHZZArS38vRRhha9ZQ88rpgfXZ6Nvc+okhbt7rFIxk4tHaKdL4GQ23cmoSX y5hARkxN6zniwPw2VRHgh+FPN/c4CiGhqz1IF+far/rNFnOjE60IzmFY5g2g32aSox d3qI6eWRK1Bw3o2lBDLltV5mBD739Cr7XyTsaUdX3KLwlaRZBnSS/Bywf93wqgCp8+ nhzH2YpDw8rU1g99efP15wOd6UX10rCnoxI8Zi56eAF47JzgWr0j8OWia85stnv3AH K57yRb8F2BsGOZLFBI7BmVFWeuMoF9P0TsZimj+iZrbi9z65HU+turpHrdV/D88k4o RkbZgsFFz6wiw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id AD5E418037E for ; Mon, 1 Dec 2025 22:19:13 +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_50,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: No X-Envelope-From: Received: from fhigh-b7-smtp.messagingengine.com (fhigh-b7-smtp.messagingengine.com [202.12.124.158]) (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 ; Mon, 1 Dec 2025 22:19:11 +0000 (UTC) Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfhigh.stl.internal (Postfix) with ESMTP id 1D3F67A01EE for ; Mon, 1 Dec 2025 17:19:06 -0500 (EST) Received: from phl-imap-01 ([10.202.2.91]) by phl-compute-04.internal (MEProxy); Mon, 01 Dec 2025 17:19:06 -0500 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=fm1; t=1764627545; x=1764713945; bh=1kNG0AD1qU/Q2VK42bfcO HXpnEuy3Hbd+3f+acjFWUE=; b=VHzcjEcYXX2KsgAA8uufR1ilfKd3XardmD2wi aYC+7gOfJ54P1tUjsduvvCtm3PGTQB78D9r8OBLH9AGmWI6CfM+/dXb7knqb5MSs i+PwsApexP9oHd+iLlLOYloddL+eRY6BKx27Ow4et7KaJ5VzypO3+Vm9yiJxnORj c1QWBpkzjJOajbHLyljN948bkmktokJY2fR/M5+4DY1pOkDq1t3susO8aIFYGdUh vRC1hTWULYgWEmhVETa/i6WDfibBHG3bw7w3WlAmfCVxMi28W0bpIKXE3IyzquTU uFveRUhqgM/5ca5bMYrYRV0VRKAF2IJm0ZFRuXrWwJHiYFbgg== 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=fm1; t=1764627545; x=1764713945; bh=1 kNG0AD1qU/Q2VK42bfcOHXpnEuy3Hbd+3f+acjFWUE=; b=cGQ9y1jeUsfzmRKBj sQCaXk/eXMj9j9LeC7b3S6YfC8VWcAaVmmKugnGLzp/2jzb5LdukJoxbvLFeEr3m jeZyzooeXtJqP0UWpmcY1Limr3w0bmNuLX3fC+y7jW546BgY+UDzbIgswiwGyQAv Cc7rReZkhVwEsH7OWTW03oOPf5nv7yQgu1r48o3zuctmcSpTPCYfo1+VB8YmVE+F DcpaHPC1RCZfSxWy8NhCTIwx3uEbwjtLAny28w9PVSUXc9DxTYsGRAJRowFH8CjQ i5oI2jqfxXH6ElUPspJPpYpWer16fjUC7hLyn3KIN+TbST3NQXL0/xSQUz7MktdC RTzSw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddvheekkeekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepofggfffhvffkjghfufgtgfesthhqredtredtjeenucfhrhhomhepfdfnrghrrhih ucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhmqe enucggtffrrghtthgvrhhnpeekgfdtfeeihedtveejffeileeukeelhfegudeuheekffdu hfetfedugedvgfefjeenucffohhmrghinhepphhhphdrnhgvthdphhhtthhpshdqhhhosh htvgigrghmphhlvgdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhep mhgrihhlfhhrohhmpehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomhdpnhgspg hrtghpthhtohepuddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepihhnthgvrhhn rghlsheslhhishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 9897D18C004E; Mon, 1 Dec 2025 17:19:05 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 X-ThreadId: AfsvarjU34r7 Date: Mon, 01 Dec 2025 16:18:45 -0600 To: "php internals" Message-ID: <9873b03e-1260-44b3-8285-af9511d8766e@app.fastmail.com> In-Reply-To: References: Subject: Re: [PHP-DEV] [RFC] [Discussion] Followup Improvements for ext/uri Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: larry@garfieldtech.com ("Larry Garfield") On Mon, Dec 1, 2025, at 2:50 PM, M=C3=A1t=C3=A9 Kocsis wrote: > Hi Everyone, > > I'd like to introduce my latest RFC that I've been working on for a=20 > while now: https://wiki.php.net/rfc/uri_followup. > > It proposes 5 followup improvements for ext/uri in the following areas: > - URI Building > - Query Parameter Manipulation > - Accessing Path Segments as an Array > - Host Type Detection > - URI Type Detection > - Percent-Encoding and Decoding Support > > I did my best to write an RFC that was at least as extensive as=20 > https://wiki.php.net/rfc/url_parsing_api had become by the end. Despit= e=20 > my efforts, > there are still a couple things which need a final decision, or which=20 > need to be polished/improved. Some examples: > > - How to support array/object values for constructing query strings?=20 > (https://wiki.php.net/rfc/uri_followup#type_support) > - How to make the UriQueryParams and UrlQueryParams classes more=20 > interoperable with the query string component (mainly with respect to=20 > percent-encoding)?=20 > (https://wiki.php.net/rfc/uri_followup#percent-encoding_and_decoding) > - Exactly how the advanced percent-decoding capabilities should work?=20 > Does it make sense to support all the possible modes=20 > (UriPercentEncodingMode) for percent-decoding as well=20 > (https://wiki.php.net/rfc/uri_followup#percent-encoding_and_decoding_s= upport) > - etc. > > Regards, > M=C3=A1t=C3=A9 Thanks, M=C3=A1t=C3=A9. =20 Notes as I read through:=20 - I really, really hate the "set" prefix on all the methods. It's a bui= lder object, surely the "set" is implied? =20 $builder->scheme('https')->host('example.com')->path('/foo/bar')->build(= ); That's nice and easy to read. - It really feels like there's an interface to extract here from the Url= /UriBuilder classes. There's literally only one type-specific method (b= uild()). - UriQueryParams::hasWithValue(), could that be just hasValue()? You st= ill need to specify the key anyway, and that's self-evident from the sig= nature. - There's a count() method, so shouldn't Ur{i|l]QueryParams implement Co= untable? - As above, there really is an interface lurking in UriQueryParams... - Why both Uri getRawQueryParams() and getQueryParams()? It looks like = they would return the same value, no? (If not, that should be explained= .) - The sort() method... should it take an optional user callback, or do w= e lock people in to lexical ordering? - It would be quite convenient of set() and append() returned $this, all= owing them to be chained. - The fromArray() logic is... totally weird and unexpected and I hate it= . :-) Why can't you support repeated query parameters using nested arra= ys rather than gumming up all calls with a wonky format? - It's not clear how one would start a new query from scratch, with the = private constructor. There doesn't seem to be a justification for the p= rivate. I can't see why new UriQueryParams()->set('foo', 'bar') is a ba= d thing. - Type support: Looks reasonable to me. - The HostType logic seems reasonable to me. - Url::isSpecial() Could we come up with a better name here? "Special" = could mean anything unless you know the RFC; it feels like "real escape = string" all over again. Some parts of this are over my head as I've not read the relevant RFCs, = but overall I do like the direction. --Larry Garfield