Bug #77763 [Opn]: parse_url doesn't retrieve the right scheme when url has another ":" after "@"

From: Date: Mon, 18 Mar 2019 14:05:53 +0000
Subject: Bug #77763 [Opn]: parse_url doesn't retrieve the right scheme when url has another ":" after "@"
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-220045@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77763&edit=1

 ID:                 77763
 User updated by:    juanparati at gmail dot com
 Reported by:        juanparati at gmail dot com
 Summary:            parse_url doesn't retrieve the right scheme when url
                     has another ":" after "@"
 Status:             Open
 Type:               Bug
 Package:            *URL Functions
 Operating System:   MacOs 10.14.3 (Darwin 18.2.0)
 PHP Version:        7.2.16
 Block user comment: N
 Private report:     N

 New Comment:

Description:
------------
I found that "parse_url" function doesn't retrieve the scheme with "git"
style urls.



Test script:
---------------
// It works correctly with this case
echo parse_url('http://user:pass@example.net', PHP_URL_SCHEME)
=== 'http' ? 'http' : 'no scheme';

// It doesn't work correctly for the following case
echo parse_url('git://git@example.net:myorg/my-repo.git', PHP_URL_SCHEME) ===
'git' ? 'git' : 'no scheme';



Expected result:
----------------
The expected result is to resolve the scheme as "git" for git urls like:
"git://git@example.net:myorg/my-repo.git"

Actual result:
--------------
"false" is receive


Previous Comments:
------------------------------------------------------------------------
[2019-03-18 14:03:06] juanparati at gmail dot com

Description:
------------
I found that "parse_url" function doesn't retrieve the scheme when more than one
semicolon is used and url doesn't contain the hostname separator.



Test script:
---------------
// It works correctly with this case
echo parse_url('http://user:pass@example.net', PHP_URL_SCHEME)
=== 'http' ? 'http' : 'no scheme';

// It doesn't work correctly for the following case
echo parse_url('git://git@example.net:myorg/my-repo.git', PHP_URL_SCHEME) ===
'http' ? 'GIT' : 'no scheme';



Expected result:
----------------
The expected result is to resolve the scheme as "git" for git urls like:
"git://git@example.net:myorg/my-repo.git"

Actual result:
--------------
"false" is receive


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=77763&edit=1


Thread (3 messages)

« previous php.bugs (#220045) next »