zendframework/zend-uri

Invalid parsing/encoding of the URI userinfo

Opened this issue · 1 comments

Some characters are not properly parsed from string, and encoded when converted to string, in the userinfo. For example, the "@" char should be represented in strings as "%40" (but passed as "@" to the Authorization header for HTTP), and userinfo containing percent-encoded chars should be decoded/encoded the right way.

It seems that the following comment about "@" in https://github.com/zendframework/zend-uri/blob/master/src/Uri.php#L297 is wrong:

                // The userInfo can also contain '@' symbols; split $authority
                // into segments, and set it to the last segment.

form my understanding of the RFC-3986:

    userinfo    = *( unreserved / pct-encoded / sub-delims / ":" )
    unreserved  = ALPHA / DIGIT / "-" / "." / "_" / "~"
    pct-encoded = "%" HEXDIG HEXDIG
    sub-delims  = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "="

This repository has been closed and moved to laminas/laminas-uri; a new issue has been opened at laminas/laminas-uri#2.