php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77763 parse_url doesn't retrieve the right scheme when url has another ":" after "@"
Submitted: 2019-03-18 14:03 UTC Modified: 2019-03-18 15:40 UTC
From: juanparati at gmail dot com Assigned:
Status: Not a bug Package: *URL Functions
PHP Version: 7.2.16 OS: MacOs 10.14.3 (Darwin 18.2.0)
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
7 + 9 = ?
Subscribe to this entry?

 
 [2019-03-18 14:03 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-03-18 14:05 UTC] juanparati at gmail dot com
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
 [2019-03-18 15:40 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2019-03-18 15:40 UTC] requinix@php.net
git://git@example.net:myorg/my-repo.git is a valid URI but it is not a valid *URL*.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Sep 19 02:03:37 2021 UTC