[php-src] Issue #19913: Uri\WhatWg\Url host validation when using withHost
| From: | nyamsprod | Date: | Mon, 22 Sep 2025 08:12:38 +0000 |
| Subject: | [php-src] Issue #19913: Uri\WhatWg\Url host validation when using withHost | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-250876@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/19913
Author: nyamsprod
### Description
The following code:
```php
<?php
echo new
Uri\WhatWg\Url('data:toto')->withHost('example.com')->toAsciiString();
```
Resulted in this output:
```
data://example.comtoto
```
But I expected this output instead:
```
an InvalidUrlException to be thrown
```
data URL are URLs with opaque path. URLs with opaque path always have a host which is
null
tested using https://3v4l.org/J9IHN/rfc#vgit.master
### PHP Version
```plain
Runtime: PHP 8.5.0-dev
```
### Operating System
_No response_