[php-src] Issue #19944: Uri\WhatWg\Url Port validation when using withPort
| From: | nyamsprod | Date: | Wed, 24 Sep 2025 08:39:34 +0000 |
| Subject: | [php-src] Issue #19944: Uri\WhatWg\Url Port validation when using withPort | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-250905@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/19944
Author: nyamsprod
### Description
The following code:
```php
<?php
new \Uri\WhatWg\Url('https://example.com:432')->withPort(-1)->toAsciiString();
```
Resulted in this output:
```
'https://example.com:432'
```
But I expected this output instead:
```
Uri\WhatWg\InvalidUrlException: The specified port is malformed (PortOutOfRange)
```
see: https://3v4l.org/q66W3/rfc#vgit.master
### PHP Version
```plain
PHP 8.5-dev
```
### Operating System
_No response_