Re: [RFC] [Discussion] Add WHATWG compliant URL parsing API

From: Date: Fri, 04 Apr 2025 17:46:55 +0000
Subject: Re: [RFC] [Discussion] Add WHATWG compliant URL parsing API
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17  Groups: php.internals 
Request: Send a blank email to internals+get-127044@lists.php.net to get a copy of this message
On 02/04/2025 19:59, Máté Kocsis wrote:
Hi Ignace,
    I spotted another inconsistency in the normalization under RFC3986
Thanks for spotting this: apparently, it is due to a small bug in the uriparser library, which I managed to fix locally, PR is on its way to upstream. Máté
Hi Máté I have a couple of questions regarding RFC3986\Uri - I believe during normalization of IPv6 host the letter a-f should be lowercase in accordance with the RFC since RFC3986 follows https://www.rfc-editor.org/rfc/rfc3513 which has been replaced by https://www.rfc-editor.org/rfc/rfc4291 which is updated by https://www.rfc-editor.org/rfc/rfc5952#section-4.3 which recommends lowecasing the letters. (yeah that was quite a digging I know 🙂 ) - Since the withers expect well encoded components does it means that it is the same for the constructor. What is the expected result for the following code ?
$uri =new Uri\Rfc3986\Uri("https://example,com/?foo[]=1&foo[]=2");
Should the above trigger an exception because the query component contain invalid characters or is it acceptable ? Asking because currently our dear old parse_url does not fail on this and probably most PHP developers expect this not to fail. IMHO I am in favor of it failing to get a consistent experience when using the class because otherwse you introduce an inconsistency between the constructor behaviour and the rest of the class API. Best regards, Ignace Nyamagana Butera

« previous php.internals (#127044) next »