[php-src] Issue #23965: Uri\Rfc3986\Uri::toString() doesn't drop an empty port
| From: | kamil-tekiela | Date: | Mon, 28 Sep 2026 12:13:50 +0000 |
| Subject: | [php-src] Issue #23965: Uri\Rfc3986\Uri::toString() doesn't drop an empty port | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-252842@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/23965
Author: kamil-tekiela
### Description
The following code:
```php
<?php
require 'vendor/autoload.php';
$uri = new Uri\Rfc3986\Uri('https://example.com:');
var_dump($uri->getPort(), $uri->toRawString(), $uri->toString());
```
Resulted in this output:
```
NULL
string(20) "https://example.com:"
string(20) "https://example.com:"
```
But I expected this output instead:
```
NULL
string(20) "https://example.com:"
string(19) "https://example.com"
```
### PHP Version
```plain
8.5.4
```
### Operating System
_No response_