Re: [RFC] [Discussion] Add WHATWG compliant URL parsing API
| From: | ignace nyamagana butera | Date: | Sun, 27 Apr 2025 20:30:24 +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 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-127207@lists.php.net to get a copy of this message | ||
Hi Maté
I see you updated the RFC but I believe there's still some errors in the
example:
$url = Uri\WhatWg\Url::parse("/foo", ".com"); //
Throws Uri\WhatWg\InvalidUrlException because of $baseUri
Since parse is used shouldn't it return null instead of throwing ?
$uri = Uri\Rfc3986\Uri::parse("https://%e4%bd%a0%e5%a5%bd%e4%bd%a0%e5%a5%bd.com");
// percent-encoded form of https://你好你好.com
<https://xn--6qqa088eba.com>echo $uri->toString();
// https://%e4%bd%a0%e5%a5%bd%e4%bd%a0%e5%a5%bd.com
RFC3986 host normalization states that URL encoded part should be encoded
using uppercased letter so on normalization:
https://%e4%bd%a0%e5%a5%bd%e4%bd%a0%e5%a5%bd.com
should be
https://%E4%BD%A0%E5%A5%BD%E4%BD%A0%E5%A5%BD.com
I updated my polyfill to reflect the latest changes in the RFC