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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: juanparati at gmail dot com
New email:
PHP Version: OS:

 

 [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-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 12:01:27 2024 UTC