[php-src] Issue #20545: Uri::withUserInfo modify the password component even if not present
| From: | nyamsprod | Date: | Thu, 20 Nov 2025 22:47:57 +0000 |
| Subject: | [php-src] Issue #20545: Uri::withUserInfo modify the password component even if not present | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-251264@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/20545
Author: nyamsprod
### Description
The following code:
```php
$uri = new \Uri\Rfc3986\Uri('http://example.com');
$uri1 = $uri->withUserInfo('');
echo $uri->getRawPassword();
echo $uri1->getRawPassword();
```
Resulted in this output:
```
NULL
''
```
But I expected this output instead:
```
NULL
NULL
```
The password should only be set if the userInfo receives a string containing at least the
: character. If not present the password component should stay equal to
null.
### PHP Version
```plain
PHP 8.5.0
```
### Operating System
not relevant