Skip to content

Missing test regarding UriInterface#withUserInfo and passwords containing invalid URL characters #61

Closed
@boesing

Description

@boesing

PHP version: ANY

Description

I recently had an issue with a PSR-7 implementation which does not urlencode passwords when passed to UriInterface#withUri.
At least ext-curl has problems with some characters (not all) when used within the username and/or password.

How to reproduce

$uri = $uri->withScheme('http');
$uri = $uri->withHost('example.org');
$uri = $uri->withUserInfo('username', 'password#');

echo (string) $uri; // http://username:password#@example.org => when used with curl, curl error 3 malformed uri

I do not expect usernames to work with special characters, but having secure passwords usually contain one or more special characters (including #) which do definitely lead to curl error 3 malformed uri.

Possible Solution

I'd prefer an integration test which verifies that (at least passwords) UriInterface#withUserInfo uses urlencode to encode user info.

Additional context

Adding a Screenshot from XDEBUG having the issue with the # inside the userInfo (which is not urlencoded) along with the errno which guzzle adds to the EasyHandle after executing the request.

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions