Skip to content

Reorder priorities of PSR-17 factories #222

@boesing

Description

@boesing

Description

Hey there,
I recently ran into an issue regarding urlencode of userInfo. Due to whatever reasons, nyholm/psr7 does not encode the password and thus, curl returns error code 3 (malformed URI) when executing a request with a password containing characters which need to be urlencode.

Since nyholm/psr7 did not received any updates for quite a long time, I assume it is either not maintained or the pace of fixing issues reduced. Since there are PSR-17 implementations of industry approved libraries, I am not quite sure why nyholm/psr7 has almost the highest priority when detecting PSR-17 factories.

For example:

  • guzzle/psr7
  • slim/psr7
  • laminas/diactoros

When it comes to PSR-18, symfony and guzzle have the highest priorities and there are no doubts. I'd expect guzzle to always overrule nyholm/psr7 as well.

Example

$uri = new \Nyholm\Psr7\Uri('http://example.org');
$uri = $uri->withUserInfo('username', 'password#');

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

$uri = new \GuzzleHttp\Psr7\Uri('http://example.org');
$uri = $uri->withUserInfo('username', 'password#');

echo (string) $uri; // http://username:password%23@example.org => when used with curl, all good

Additional context

It also seems that @Nyholm is not interested in interoperability of his component.

I just quickly checked PSR7 specification and it does not mention anything about URL encoding.

Nyholm/psr7#202 (comment)

I see no reason to change unless a PSR is updated with clear guidelines.

Nyholm/psr7#99 (comment)

When I understand this discovery component correct, it is expected that every discovered PSR-18/PSR-17 implementation does support the same functionality as if not - it won't be interchangeable.

Since in the mentioned comments above the response was "I dont care unless PSR cares" while the authors of the issues stated that other implementations actually do support these (so not just one), I frankly would prefer having nyholm/psr7 either removed or the priority should be lowered so that other components are picked up first.

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