[php-src] Issue #19897: Uri::withPath is not compliant with RFC3986 - example2
| From: | nyamsprod | Date: | Sat, 20 Sep 2025 11:36:58 +0000 |
| Subject: | [php-src] Issue #19897: Uri::withPath is not compliant with RFC3986 - example2 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-250865@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/19897
Author: nyamsprod
### Description
The following code:
```php
<?php
use Uri\Rfc3986\Uri;
echo (new Uri('foo/bar'))->withPath('//foo')->toString();
```
Resulted in this output:
```
//foo
```
But I expected this output instead:
```
Uri\InvalidUriException should be thrown because if there is no authority the path
//foo cannot start with a //.
```
### PHP Version
```plain
Runtime: PHP 8.5.0-dev
```
### Operating System
_No response_