src/Uri.php
/**
     * Filters a part of user info in a URI to ensure it is properly encoded.
     *
     * @param string $part
     * @return string
     */
Filters a part of user info in a URI to ensure it is properly encoded.
@param string $part
@return string
Filters a part of user info in a URI to ensure it is properly encoded . @param string $part @return string
private function filterUserInfoPart(string $part) : string
    {
        $part = $this->filterInvalidUtf8($part);
        return preg_replace_callback(
            '/(?:[^%' . self::CHAR_UNRESERVED . self::CHAR_SUB_DELIMS . ']+|%(?![A-Fa-f0-9]{2}))/u',
            [$this, 'urlEncodeChar'],
            $part
        );
    }
private function filterUserInfoPart ( string $ part ) : string { $ part = $ this -> filterInvalidUtf8 ( $ part ) ; return preg_replace_callback ( '/(?:[^%' . self :: CHAR_UNRESERVED . self :: CHAR_SUB_DELIMS . ']+|%(?![A-Fa-f0-9]{2}))/u' , [ $ this , 'urlEncodeChar' ] , $ part ) ; }
Filters a part of user info in a URI to ensure it is properly encoded.
Filters a part of user info in a URI to ensure it is properly encoded .
// Note the addition of `%` to initial charset; this allows `|` portion // to match and thus prevent double-encoding.