Re: [RFC] [Discussion] Add WHATWG compliant URL parsing API
| From: | Tim Düsterhus | Date: | Sun, 27 Apr 2025 20:32:44 +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-127208@lists.php.net to get a copy of this message | ||
Hi
On 4/27/25 22:30, ignace nyamagana butera wrote:
$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 ?
In this case the $baseUri is invalid. Since this is not expected to be an untrusted value, it makes sense to me to throw an InvalidUrlException here. The null return should only be used for an invalid $uri.
Best regards
Tim Düsterhus